Magento - Owebia - Apply conditions for specific list of skus
-
03-03-2021 - |
سؤال
Using Owebia, I need to apply a specific fee for certain product skus (from 001 to 099). I know the function I need to use with Owebia, but I don't know how to set the array of skus in the cart:
{
"special_skus": {
"label": "Restriction",
"description": "Restriction",
"shipto": "UK",
"conditions": "array_match_any(SKUS_IN_CART), array('001','002'...[...]))",
"fees": 200
}
Is there a way I can get this list? Should I do it in a different way? My final logic is more complicated: I just simply don't way to allow deliveries to some countries for certain products, but before I do that, I need to get something simpler working.
Thanks!
المحلول
After some tests I've finally found the correct configuration. You'll find my configuration file in here:
https://gist.github.com/PauGNU/1eb7045d660ebe61e51987554e3a1450
The steps to get this to work were:
- First of all I created the basic rules for shipping (just weigth/destionation)
I created a rule which would only have a «condition» looking for products in the cart. This rule returns true when the products 003465 and 033339 are not present in the cart:
"skus_es_gi_ad": { "conditions": "({count items where product.attribute.sku=='003465'} < 1) && ({count items where product.attribute.sku=='033339'} < 1)" }
Finally, in one of my width/destination rules I added this condition:
"US_shipping": { "label": "United States", "description": "USA Shipping", "shipto": "US", "conditions": "{skus_es_gi_ad.conditions}", "fees": "{table {cart.weight} in 0.5010:25.1460,1.0010:31.4820}" }