• Resolved elmersw

    (@elmersw)


    I just added gift cards to my webshop using the PW Gift Cards plug-in. The gift cards are treated as payment method. My shipping costs are based on total cart value. I noted the shipping costs are actually calculated according to the rate table based on the cart value without the gift cards in the cart. Exactly as I would expect, as the gift card will be send by e-mail and have nothing to do with shipping.

    However, the gift cards in the cart are taken into account for free shipping.

    This seems inconsistent to me.

    I offer free shipping for orders over EUR 70. Suppose my customer adds gift cards amounting to EUR 50 to his cart. No shipping options will be available and no shipping fees are calculated (as expected).

    Suppose the same customer adds physical products amounting to EUR 25 as well. Total order amount will be EUR 75. The result will be free shipping. In this case the shipping cost should be calculated based on an order value of EUR 25. As gift cards are treated as a payment method, they are not considered revenue. Revenue is recognized when physical products are bought and paid with either a bank transfer, cash or gift card. This is correctly implemented in my webshop, except for the free shipping threshold.

    I have found a workaround for this issue: I do not set a free shipping threshold in the shipping options (of the FS plugin). Instead I have added an extra row to the table and set the shipping costs to zero for cart value > EUR 70. Now the shipping costs are calculated as expected. However, the free shipping notice is no longer displayed. I like that notice as it will call customers to add more products to their cart.

    So, in short, the rate table seems to use another basis than the free shipping threshold.

    How can I exclude the gift cards from the free shipping threshold and still maintain the notice?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support kozyraola

    (@kozyraola)

    Hello @elmersw,

    did you change the Cart Calculation in your Flexible Shipping method configuration?

    In section Cost Calculation here you can choose how you would like the costs to be calculated: based on cart value (this will include virtual products) and based od package value (this will exclude virtual products it is not taken into consideration when calculating free shipping).

    Here is the outcome at the checkout (free shipping over amount: 70).

    And here is the outcome when the amount is over 70.

    Greetings,
    Ola

    Thread Starter elmersw

    (@elmersw)

    @kozyraola

    Cost calculation has already been set to ‘package value’. I took some snapshots as well to illustrate what happens in my shop.

    Here is the settings page and the outcome when the free shipping limit was set.

    The settings and the outcome when leaving the free shipping threshold blank and adding an extra line in the table.

    Plugin Support kozyraola

    (@kozyraola)

    Hi @elmersw,

    thank you for sending the additional information and screenshots.

    If I understand correctly, you need this notice to display the amount that is left for free shipping based on the package value calculation?

    Greetings,
    Ola

    Thread Starter elmersw

    (@elmersw)

    Hi @kozyraola ,

    That is indeed the notice I like to show. In my case I’d like to show the remaining amount until the package value is reached.

    More in general I expect the remaining amount is calculated based on the cart value. The settings how the cart value is calculated (total, package value etcetera) should be taken into account.

    Plugin Support kozyraola

    (@kozyraola)

    Hello @elmersw,

    thank you for the confirmation.

    Unfortunately it is not possible to configure the free shipping notice this way at the moment.

    It is because this section will override the Cost Calculation section and Shipping Cost Calculation rules from the table.

    Best regards,
    Ola

    Thread Starter elmersw

    (@elmersw)

    As mentioned above I use a workaround by adding an extra line to the rate table. In addition I have added my own free shipping notice. Code is pasted below. The code is not generally applicable, but it might be used as a basis.

    `/**
    * Free shipping notice to replace Flexible Shipping notice and extend to local delivery
    * Free shipping threshold FS turned off as it does not work correctly for gift cards
    * IMPORTANT: shipping package contains the total cost of items that need shipping WITHOUT TAX
    * This function adds tax by using a simple formula on the total
    * In case different tax rates apply to items in a package, one should loop over the items in the package
    */
    add_action( ‘woocommerce_before_cart’, ‘sw_free_shipping_notice’ );
    add_action( ‘woocommerce_before_checkout_form’, ‘sw_free_shipping_notice’ );

    function sw_free_shipping_notice() {

    //Determine shipping method
    $chosen_methods = WC()->session->get( ‘chosen_shipping_methods’ );
    $chosen_shipping = $chosen_methods[0];

    if ( 0 === strpos( $chosen_shipping, ‘local_pickup’ ) ) {
    return;
    } elseif (0 === strpos( $chosen_shipping, ‘free_shipping’ ) ) {
    return;
    } else {
    $taxrate = 1.21; // general tax rate
    $current_amount = 0;

    $shipping_packages = WC()->cart->get_shipping_packages();
    foreach ( $shipping_packages as $package_id => $package ) {
    $current_amount += $package[‘contents_cost’];
    }
    $shipping_value = $current_amount * $taxrate;

    if ( $chosen_shipping == “flat_rate:4” ) {
    $min_amount = 50; //change this to your free delivery threshold
    $method = “bezorging”;
    } else {
    $min_amount = 70; //change this to your free shipping threshold
    $method = “verzending”;
    }

    if ( $shipping_value < $min_amount ) {
    $amount = wc_price( $min_amount – $shipping_value );
    $return_to = wc_get_page_permalink( ‘shop’ );
    $notice = sprintf( ‘Besteed nog %1$s voor gratis %2$s! %3$sGa door met winkelen%4$s’, $amount, $method, ‘‘, ‘‘ );
    wc_print_notice( $notice, ‘notice’ );
    }
    }
    }

    Thread Starter elmersw

    (@elmersw)

    I just discovered the problem described above is not only related to the Flexible Shipping plug-in. It also appears when I select a standard WC flat rate, which I use for local delivery. So it appears the problem is caused by the combination of PW Gift Cards and Woocommerce.

    Plugin Support kozyraola

    (@kozyraola)

    Hello @elmersw,

    thank you for sharing your workaround.

    Sorry there was nothing more we could do regarding this case.

    Please let me know if I can mark this thread as resolved.

    Have a great day,
    Ola

    Thread Starter elmersw

    (@elmersw)

    Marked it as resolved as there’s nothing you can do right now. Thanks for your help.

    Thread Starter elmersw

    (@elmersw)

    Thanks to the guys from Pimwick, I discovered that the free shipping calculation in your plug-in differs from the Woocommerce method. I have been able to successfully modify the ‘woocommerce_shipping_free_shipping_is_available’ filter when using the standard WC shipping rates. I disabled Flexible Shipping and turned on flat rate and free shipping.

    But when using only Flexible Shipping and disabling the standard Woocommerce shipping methods, the filter is ignored.

    Even though I have found a workaround, I still like to use the free shipping option in your plug-in as the free shipping notice is pretty convenient. If it’s not necessary, I don’t want to add these notices myself.

    I came across this page where the available hooks are listed. Unfortunately not all hooks are documented. Any chance I could use one of these hooks to modify the subtotal taken into account for the free shipping threshold?

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Gift cards counting towards free shipping’ is closed to new replies.