I already set up my ecommerce shop to sale digital products by using woocommerce. Now to show my product demo, I am trying to add a Live Demo Button before add to cart button in Woocommerce single product page.
I can do it easily by using bellow code:
//add live demo button to single product page
function shameem_before_add_to_cart_form() {
global $post;
$demoslug = $post->post_name;
$demourl = get_bloginfo('url').'/'.$demoslug.'/';
$demotitle = esc_attr($post->post_title);
echo 'Live Demo';
}
add_action('woocommerce_before_add_to_cart_form','shameem_before_add_to_cart_form');
If I used those code, then my Live demo button url will be: http://ift.tt/1u7s6eP
But I want live demo button url will be http://ift.tt/1yGrhGq
Is there any other way I can do what I am expecting, or any modification that can change my url to demo.siteurl.com.
Here is an image about what I am looking for:
Any help will be appreciated. Thanks
Aucun commentaire:
Enregistrer un commentaire