I'm setting up the Google shopping feed for a new site and I need to provide a cost for shipping on each item but I can't find any way to get the lowest possible (or any) shipping cost for that item. How can I get this?

  • How are you passing this to google/ Are you building an RSS feed in a template? The shipping cost depends on your entire order, there is no way to display an individual price for an item without adding it to your cart. – Adrian Macneil Aug 5 '13 at 17:50
  • I'm taking the RSS / XML feed approach as part of the template. I was hoping to be able to easily get a minimum price for shipping on an item based on assumed location and cheapest cost. Essentially speaking, the same price as if I'd added it to the cart by itself and gone with that. – Leonard Aug 5 '13 at 18:47
  • In that case your only option is either to hard code it, or use the query module to extract the shipping costs directly from the database. There aren't any Store tags to display shipping costs before an item is in your cart. – Adrian Macneil Aug 5 '13 at 19:10
  • I'll probably give the query method a shot. Is there anywhere in the core files I might be able to take a peek at the logic of how you put together shipping costs to help put me in the right direction? – Leonard Aug 6 '13 at 10:34
  • 1
    It depends how complex your shipping rules are. Best starting point would be to take a look at the calculate_shipping() method in store/libraries/store_shipping/store_shipping_default.php. – Adrian Macneil Aug 6 '13 at 17:01

It's not possible using the native Store tags to calculate the shipping address for an item before you add it to your cart (because that would require a destination address).

If you need to do this, the best way would be to use the EE query module to query the exp_store_shipping_rules table and select the correct rate based on the item size/weight and destination country/state. How complicated this is depends on how many shipping rules you have set up and which attributes of the product you are using to calculate rates.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.