Thread Starter
amila
(@flatworld21)
I did it by this
<script type='text/javascript'>
/* <![CDATA[ */
var wc_add_to_cart_params = {"ajax_url":"\/wp-admin\/admin-ajax.php","wc_ajax_url":"\/?wc-ajax=%%endpoint%%","i18n_view_cart":"View cart","cart_url":"http:\/\/testestste.com\/checkout\/","is_cart":"no","cart_redirect_after_add":"yes"};
/* ]]> */
</script>
<a class="button product_type_simple add_to_cart_button ajax_add_to_cart added" href="/buypage/?add-to-cart=8346" rel="nofollow" data-quantity="1" data-product_id="8346" data-product_sku="" aria-label="Add “test” to your cart">Check out</a>
Kenin
(@kbassart)
Automattic Happiness Engineer
The best way to do this would be to use one of the shortcodes in WooCommerce, or use a custom Add to Cart URL as outlined here: https://businessbloomer.com/woocommerce-custom-add-cart-urls-ultimate-guide/