• This sample plugin is exactly what I need.
    Unfortunately with the latest version of Woocomerce (3.0.2_ and WordPress (4.7.3), I can’t get it to work.
    Eg, I make a product a sample that is free, select the sample in the frontend shop, but the full price of the product still shows in the cart and checkout.

    Is there something I am missing? or is your plugin not compatible with the latest version of Woocommerce and WordPress.

    Many thanks in advance.

Viewing 15 replies - 1 through 15 (of 18 total)
  • alterlondon

    (@alterlondon)

    I’m having the same issue. The plugin is great but the price shown in cart is not correct.
    I’m happy to pay if someone is able to fix it asap.

    DesFab

    (@desfab)

    Same here. Downgraded WordPress to 4.6.5 and also woo commerce down to 3.0.0 and it shows the full price in the cart?

    HELP!

    btsllc

    (@btsllc)

    I am experiencing the same issue after updating to Woocommerce 3.0.4

    delacour.corp

    (@delacourcorp)

    Same problem for me πŸ™

    Does anyone got an answer or some idea ?
    I’ve tryed to debug woocommerce-sample.php but found nothing, sample_price variable seems not to be send in the cart, whatever I try, even filling it manualy or using a free sample option…

    delacour.corp

    (@delacourcorp)

    @desfab, I went on your site designerfabricstore.co.uk and saw you seem to have solved the problem, any help ?

    Thread Starter userland

    (@userland)

    The Git repo for the plugin is here with 3 contributors, if that is any use:

    https://github.com/isikom/woocommerce-sample

    • This reply was modified 9 years ago by userland.
    delacour.corp

    (@delacourcorp)

    Thanks @userland, I’ve tried to ask my question there, we’ll see…

    DesFab

    (@desfab)

    Hi delacour,

    I actually had to revert to the old version of woo commerce as I couldn’t fix it. I am in a bit of fix actually as I go on maternity leave very soon so at present will be leaving the site without a major woo commerce update. Any ideas on the issue?

    Many thanks,
    Becks

    delacour.corp

    (@delacourcorp)

    No ideas yet, anyway thanks for you contribution, leading me to the idea that a downgrade restoration is needed…

    btsllc

    (@btsllc)

    I have been trying to debug the code and have gotten to far. If I fine a solution, I will post something.

    mo5280

    (@mo5280)

    Hi guys just thought I would chime into this, I have been trying to come up with a solution to this with no luck. I even found the “Zauker” developer on Linkedin and messaged him regarding this, I got an initial response but once I told him about the issue with his plugin the message was read but ignored and no response since….. even after i offered to pay.

    The issues is Woocommerces new product CLI that is used from 3.+ update so to continue using this plugin your woocommerce cannot be updated to version 3.0 or above.

    Hope someone can come up with a fix or easy alternative

    delacour.corp

    (@delacourcorp)

    Does someone tested the sample plugin with the latest woocommerce 3.0.6 update ? Anything encouraging somewhere ?

    btsllc

    (@btsllc)

    I have given up, trying to debug the code and begun dissecting it by using the existing foundation to provide a solution. As soon as I come up with something, I will post what I have and maybe we all can build on it. However, I am new to PHP, but making good progress. I have a client whose site I need to lunch soon…

    delacour.corp

    (@delacourcorp)

    Does someone have tested an alternative plugin ? Maybe the solution is here πŸ˜‰
    I’m going to do some searches…

    commercepundit

    (@commercepundit)

    I have also faced same issue. And Below codes solve my issue.
    Please put this in theme functions.php

    add_action( 'woocommerce_before_calculate_totals','cp_add_custom_price', 10, 1);
    function cp_add_custom_price( $cart_obj ) {
        //  This is necessary for WC 3.0+
        if ( is_admin() && ! defined( 'DOING_AJAX' ) )
            return;
            
        foreach ( $cart_obj->get_cart() as $key => $value ) {
            if($value['sample']){
                $product_id = $value['product_id'];
                $sample_price_mode = get_post_meta($product_id, 'sample_price_mode', true) ? get_post_meta($product_id, 'sample_price_mode', true) : 'default';
                $sample_price = get_post_meta($product_id, 'sample_price', true) ? get_post_meta($product_id, 'sample_price', true) : 0;
                if ($sample_price_mode === 'custom'){
                    $price = $sample_price;
                }else if ($sample_price_mode === 'free'){
                    $price = 0;
                }else{
                    $price = $value['data']->price;
                }
                $value['data']->set_price( $price );
            }
    
        }
    }

    [Moderator note: code fixed. Please wrap code in the backtick character or use the code button.]

    Hope this helps you…

    • This reply was modified 9 years ago by Jan Dembowski.
    • This reply was modified 8 years, 12 months ago by bdbrown.
Viewing 15 replies - 1 through 15 (of 18 total)

The topic ‘Selecting Sample shows full price’ is closed to new replies.