• Resolved amarmustaqim

    (@amarmustaqim)


    Hi there,

    I have created a customize direct checkout button beside add to cart in single product page.

    This is the code:

    //add direct checkout button 
    function insertcart_addtocart_button_func() {
            // echo content.
    		global $product;
    		$pid = $product->get_id();
    		$quicklink = WC()->cart->get_checkout_url();
            echo '<div class="button quickcheckout"><a href="'.$quicklink.'?add-to-cart='.$pid.'">'.esc_attr('Quick Checkout').'</a></div>';
    }
    add_action( 'woocommerce_after_add_to_cart_button', 'insertcart_addtocart_button_func' );

    But I want to disable the direct checkout button (make it unclickable) if no variation was selected. May I know what should I add to this code?

    Thank you in advance.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    Hi there ??

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Cheers!

    Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    We’ve not seen any activity on this thread for a while, so I’m marking this thread as resolved.

    Hopefully, you were able to find a solution to your problem! If you have further questions, please feel free to open a new topic.

    Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Disable customize direct checkout button if no variation selected’ is closed to new replies.