• Resolved mserafini

    (@mserafini)


    Hi

    I would like to have two rates per Km:
    One for deliveries Mon-Fri
    Two for deliveries Sat-Sun

    I looked at the files and found this below. Is this the right way to go? Can you assist? Thank you

    * This example shows how you can modify the $result var via custom function:
    *
    * add_filter( ‘wcsdm_calculate_shipping_cost’, ‘my_get_rate’, 10, 4 );
    *
    * function my_calculate_shipping_cost( $rate, $api_response, $package, $obj ) {
    * // Return the cost data array
    * return array(
    * ‘cost’ => 0,
    * ‘label’ => ‘Free Shipping’,
    * ‘meta_data’ => array(),
    * );
    * }

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Sofyan Sitorus

    (@sofyansitorus)

    Hi,

    The second argument for the add_filter function suppose the function name you want to hook. In your case it suppose my_calculate_shipping_cost instead my_get_rate. Also you need to add conditional check inside the my_calculate_shipping_cost function to check the days you want to return Free shipping. For your current code it will return Free Shipping everyday.

    Thread Starter mserafini

    (@mserafini)

    Tahnk you Sofyan.
    What I posted I found it in the plugin file, it’s your code I think. wcsdm/includes/class-wcsdm.php

    So I don’t want to accomplish what’s there at all.

    Plugin Author Sofyan Sitorus

    (@sofyansitorus)

    Whoops my bad, will update the example in the next release. Thanks for reporting it.

    Thread Starter mserafini

    (@mserafini)

    Ok, thank you for your help. That is the way to do what I would like I think

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Weekend Rate’ is closed to new replies.