Hi,
I would like to implement the theme for my Digital Product Selling website and tried the same on my Staging site. [Added below code to the Functions.php of theme file to achive / get the demo button] – Demo URL is available in the WooCommerce Product Advanced Tab.
But, I would like to format the button. [may be you have a better option to just place a standard xStore button and pull the URL from my woocommerce product advance tab] – Please advise.
/**
* Snippet Name: WooCommerce Custom Product Data Metabox For Custom Button Link
* Snippet Author: ecommercehints.com
*/
add_action (‘woocommerce_product_options_advanced’, ‘ecommercehints_product_data_metabox’);
function ecommercehints_product_data_metabox() {
echo ‘
‘;
}
add_action (‘woocommerce_process_product_meta’, ‘ecommercehints_save_field_on_update’, 10, 2);
function ecommercehints_save_field_on_update ($id, $post) {
update_post_meta ($id, ‘demo_url’, $_POST[‘demo_url’]);
}
function ecommercehints_content_after_add_to_cart_form() {
global $product;
$demo_url = $product->get_meta (‘demo_url’);
echo ‘View Demo‘;
};
add_action (‘woocommerce_after_add_to_cart_form’, ‘ecommercehints_content_after_add_to_cart_form’, 10, 0);