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 Klarna Invoice and ordernumber to Fortnox ExternalInvoiceReference1 & ExternalInvoiceReference2 fields | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 3.2.5 | |
*/ | |
function redlight_fortnox_klarna_invoice_order_reference( $orderData, $order_id) { | |
$order = new WC_Order($order_id); | |
if($order->get_payment_method() == 'klarna_checkout'){ |
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 - Add Shipping charges as OrderItem instead of Shipping fee in Fortnox via functions.php | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 3.2.5 | |
*/ | |
function redlight_fortnox_shipping_as_orderLine($orderData, $order_id) { | |
$order = new WC_Order($order_id); | |
// Remove fee from orderData |
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 - Remove and Post_meta rows in Fortnox via functions.php | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 3.2.5 | |
*/ | |
function redlight_fortnox_remove_postmeta($orderData) { | |
foreach($orderData['Order']['OrderRows'] as $i => $item) { | |
if(isset($item['AccountNumber']) && $item['AccountNumber'] == 'API_BLANK') |
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 - Fortnox plugin by Redlight Media - Set TermsOfPayment depending on payment method via functions.php | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 3.2.5 | |
*/ | |
function redlight_fortnox_payment_method_TermsOfPayment($orderData, $order_id) { | |
$order = wc_get_order($order_id); | |
$order_payment_method = $order->get_payment_method(); | |
switch( $order_payment_method ) { |
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 - Changes return to shop redirect that usually appears on cart-page via functions.php | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 3.2.5 | |
*/ | |
function redlight_wc_cart_to_shop_redirect_url() { | |
return 'https://example.com/your-page/'; | |
} | |
add_filter( 'woocommerce_return_to_shop_redirect', 'redlight_wc_cart_to_shop_redirect_url' ); |
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 - Add content after "Proceed to checkout" button via functions.php | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 3.2.5 | |
*/ | |
redlight_wc_cart_after_procced_to_checkout(){ | |
$checkout_url = 'https://example.com/your-page/'; | |
?> | |
<a href="<?php echo $checkout_url; ?>" class="checkout-button button alt wc-forward"><?php _e( 'Continue shopping', 'woocommerce' ); ?></a> |
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
<? | |
function check_sync_woocommerce_product($check, $product_id){ | |
$wc_product = wc_get_product($product_id); | |
$sku = $wc_product->get_sku(); | |
$sku_chnk = explode('_', $sku); | |
$to_sync = (int) end($sku_chnk) == 1 ? false : true; | |
if($to_sync){ | |
return $check; |
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 - Add WooCommerce currency via functions.php | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 3.2.5 | |
*/ | |
function redlight_fortnox_currency($orderData, $order_id) { | |
$orderData['Order']['Currency'] = get_woocommerce_currency(); | |
return $orderData; | |
} |
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 - Add EAN code to article in Fortnox via functions.php | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 3.2.6 | |
*/ | |
function redlight_fortnox_ean( $article, $product_id) { | |
$ean_string = get_post_meta( $product_id, 'EAN', true ); | |
$article['Article']['EAN'] = $ean_string; |
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 - Add payment method title to Fortnox order-comments via functions.php | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 3.2.6 | |
*/ | |
function redlight_fortnox_payment_method_title( $orderData, $order_id) { | |
$order = wc_get_order($order_id); | |
$orderData['Order']['Remarks'] .= "\r\n"."Betalsätt: ".$order->get_payment_method_title(); |
OlderNewer