Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
is it possible to calculate shipping costs taking only in consideration the total of the products of a certain type of product?
thanks!
Comments
Comment #1
facine CreditAttribution: facine commentedWould that be correct? Or is there a better alternative?
Thanks
Comment #2
mortona2k CreditAttribution: mortona2k commentedHey, I'm new to commerce/shipping/flat rate. Where do you put this code? I just want to start by adding the flat rate for every 10 items in the cart.
Comment #3
rszrama CreditAttribution: rszrama commentedWhat you're doing in this example is looking at the line item type, which is different from the product type. There is a core Drupal Commerce condition called "Total product quantity comparison" that can compare against the total of all products in the cart, but it doesn't differentiate by product type. You could loop over the line items and tally up the total of all products of a particular type, but it would get cumbersome. Best to write a custom integration instead of trying to build it solely through the Rules interface.