• Resolved jetpackrabbit

    (@jetpackrabbit)


    I’d like to be able to charge a shipping price for every 2 items in the basket for a particular product. The product is linked to the shipping cost by shipping class. In the following example I have:

    Shipping Class = “per every 2 items”
    Shipping Cost per 2 items of £3.20

    There are many ways to do this, but the calculation I would use is:

    [qty]*1.60 + ([qty]%2)*1.60

    I don’t want to ue a plugin for thsi simple finctinality. The core product does not allow the modulus opertaor though, so I’ll probably need to create a hook in my themes functions file to achieve it.

    Any help appreciated

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    Hi there ??

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Cheers!

    See:
    includes/shipping/flat-rate/class-wc-shipping-flat-rate.php

    See lines 69 & 70. It looks like the filter to use is:
    woocommerce_evaluate_shipping_cost_args

    Exactly how would seem to be an ideal lockdown task.

    Thread Starter jetpackrabbit

    (@jetpackrabbit)

    Thanks for the help

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Extend Shipping Class Cost math’ is closed to new replies.