Web Hosting
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WooCommerce - Radio buttons and surcharge the price

Discussion in 'Troubleshooting & How-To's' started by Albertdenis, Apr 3, 2017.

  1. Albertdenis

    New Member

    Joined:
    Jan 10, 2017
    Messages:
    2
    Likes Received:
    0
    Hi,

    I want to add two radio buttons in WooCommerce and also when customer choose one option, he have to pay the price for choosing that option. Whereas no price should charge if choose other option. And also update the checkout accordingly. Here is my code

    dd_action( 'woocommerce_cart_calculate_fees','woocommerce_custom_surcharge' );

    function woocommerce_custom_surcharge() {

    global $woocommerce;

    $surcharge = 5.32;

    $woocommerce->cart->add_fee( 'Surcharge', $surcharge, true, '' );

    }
     
    #1
  2. Paul Stanely

    Member

    Joined:
    Sep 8, 2016
    Messages:
    39
    Likes Received:
    2
    #2

Share This Page

Web Hosting