richardvl
Forum Replies Created
-
Forum: Plugins
In reply to: [Advanced Order Export For WooCommerce] calculate item quantity, based on SKUHi Alex,
Sure, here’s the code:
// calculate amount of bundles per product add_filter('woe_get_order_product_value_qty',function ($value, $order, $item, $product, $item_meta) { if ($product->get_sku() == 'YH19203') { return $value = $value*2; } if ($product->get_sku() == 'YH19207') { return $value = $value*3; } else return $value; }, 10, 5);Cheers,
RichardNote: I’ve had to implement >150 if’s, but only showed 2 of them here, for the purpose of demonstrating the code.
Forum: Plugins
In reply to: [Advanced Order Export For WooCommerce] calculate item quantity, based on SKUHi there,
Nevermind!
I was able to solve the code. At last 😀Cheers!
Forum: Plugins
In reply to: [Advanced Order Export For WooCommerce] calculate item quantity, based on SKUHow do I trigger the Debug output? I have enabled it, but there is no error when I execute the export.
I get my JSON output from the export, but not with the desired effect.
Forum: Plugins
In reply to: [Advanced Order Export For WooCommerce] calculate item quantity, based on SKUChanging the quotes, does not fix the code unfortunately. the qty remains unchanged.
Forum: Plugins
In reply to: [Advanced Order Export For WooCommerce] calculate item quantity, based on SKUThanks for the help. But unfortunately the code doesn’t work yet.
The value*2 does not occur.
By looking at the link you’ve recommended, I’m still not sure how to proceed. Hopefully you’ll have another idea to complete the code.
Forum: Plugins
In reply to: [Advanced Order Export For WooCommerce] calculate item quantity, based on SKUI’ve added $product to the function now, and I can export it, although it doesn’t multiply my qty according to the specified SKU in the if statement.
// calculate amount of bundles per product
add_filter(‘woe_get_order_product_value_qty’,function ($value, $order, $fieldname, $product) {if ($product->get_sku() == ‘YH17114YHA’) {
return $value.’test’;
}else {return $value;
}},10,4);
Forum: Plugins
In reply to: [Advanced Order Export For WooCommerce] calculate item quantity, based on SKUI’m trying that now, but I can’t run the export with the following code:
// calculate amount of bundles per product
add_filter(‘woe_get_order_product_value_qty’,function ($value, $order, $fieldname) {if ($product->get_sku() == ‘YH17114YHA’) {
return $value*2;
}else {return $value;
}},10,3);
Forum: Plugins
In reply to: [Advanced Order Export For WooCommerce] calculate item quantity, based on SKUThanks for the fast response!
I have actually tried that as well, but in that case, I don’t know how to target the SKU field for my if – statement.
How would I go about that?