I am using Cartthrob_shipping_by_location_price_threshold plugin for Cartthrob.

What I need is to have a shipping by location price but, sometime I have software products, and this software products has shipping tax 0.

There is a function get_shipping() in the Cartthrob_shipping_by_location_price_threshold class:

public function get_shipping()
    $location = '';
    $customer_info = $this->core->cart->customer_info();

    $location_field = $this->plugin_settings('location_field', 'shipping_country_code');
    $backup_location_field = $this->plugin_settings('backup_location_field', 'country_code');

And I would like to override this function. One other thing, how can I access a product shipping price? As I see the shipping price field was added from Channel Administration -> Field Editor

    foreach ($this->core->cart->items() as $item)

1 Answer 1


(I'm with Vector, the people behind CartThrob)

Instead of overriding this, you should just create your own shipping plugin. You can duplicate Cartthrob_shipping_by_location_price_threshold in its folder, rename it, and update the class names/friendly name. Then you can implement any logic changes to get_shipping() you'd like.

For item price, are you looking for this?

foreach ($this->order('items') as $row_id => $item) {
    $price = $item['price'];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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