This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @snippet WooCommerce - Sets custom returnpart in Unifaun | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 6.2.0 | |
*/ | |
function redlight_unifaun_bring_return_part( $shipment, $order ) { | |
if( 'PNL342' === $shipment['service']['id'] ){ | |
$shipment['returnPart']['quickId'] = 'RETURNPART1'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @snippet WooCommerce - Set labelType to Small when getting labels from PostNord | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 5.2.0 | |
*/ | |
function redlight_postnord_labelType( $labelType, $order ) { | |
$labelType = 'small'; | |
return $labelType; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @snippet WooCommerce - Adds ADDON to Shipment | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 4.2.0 | |
*/ | |
function redlight_unifaun_postnord_addon( $shipment, $order ) { | |
// Only P19 | |
if( 'P19' === $shipment['service']['id'] ){ | |
$shipment['service']['addons'][] = array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('wp_title','custom_reviews_title',99,1); | |
add_filter('pre_get_document_title', 'custom_reviews_title',99,1); | |
function custom_reviews_title($title){ | |
if (function_exists('wcor_is_feedback_page')) { | |
if ( wcor_is_feedback_page() ) { | |
$title='Order Review Page Title'; //define your title here | |
} | |
} | |
return $title; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @snippet WooCommerce - Adds Custom reference on order | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 4.7.0 | |
*/ | |
function redlight_fortnox_custom_reference( $orderData, $order_id) { | |
$order = wc_get_order($order_id); | |
$orderData['Order']['YourReference'] = ''; | |
if($order->get_meta('_custom_reference')){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @snippet WooCommerce - Adds ADDON to Shipment | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 4.0.1 | |
*/ | |
function redlight_unifaun_best_nosign( $shipment, $order ) { | |
// Only Best Hemleverans SMALL | |
if( 'BESTHLE' === $shipment['service']['id'] ){ | |
$shipment['service']['addons'][] = array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
/** | |
* @snippet WooCommerce - Adds ADDON to Shipment | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 3.9.0 | |
*/ | |
function redlight_unifaun_bhp_return_print( $shipment, $order ) { | |
// Only Schenker Ombud | |
if( 'BHP' === $shipment['service']['id'] ){ | |
$shipment['service']['addons'][] = array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @snippet WooCommerce - Translate any text :) | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 4.6.0 | |
*/ | |
add_filter('gettext', 'translate_update_review_text'); | |
add_filter('ngettext', 'translate_update_review_text'); | |
function translate_myText($translated) { | |
$translated = str_ireplace('Hi %s! We hope that you are satisfied with your purchase with us at %s. We would to know if you would like to update your review.', '%s, do you want to update your review?', $translated); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @snippet WooCommerce - Fortnox plugin by Redlight Media - Set Accountnumber depending on VAT | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 4.6.0 | |
*/ | |
function redlight_fortnox_account_based_on_vat($orderData) { | |
foreach($orderData['Order']['OrderRows'] as $i => $item) { | |
if( $item['VAT'] == 25 ){ | |
$orderData['Order']['OrderRows'][$i]['AccountNumber'] = 3001; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @snippet WooCommerce - Order Reviews - Skip certain products | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 4.5.1 | |
*/ | |
function redlight_order_reviews_skip_certain_product( $skip, $product, $order, $line_item ) { | |
$line_item_data = $line_item->get_data(); | |
//$line_item_data['product_id'] - This now contains our product since variables doesnt support terms | |