Home Forums WoodMart support forum Add Additional button

Add Additional button

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #600016

    barisayarr
    Participant

    Hello,

    I am preparing a site where I plan to sell digital products. I need to create a “Live Demo” button on the page where the products are listed and within the product. How can I do this?

    So actually what I want is to create another button like the “add to cart” button where I can enter a custom url

    Thanks in advance.

    #600081

    Hello,

    Try to create a HTML Block and add the custom button.
    https://xtemos.com/docs-topic/html-blocks/

    Then navigate to the Theme Settings >> Single product >> Add to Cart >> Add the content in the form of HTML Block Before “Add to cart button” or After “Add to cart button”.

    Best Regards

    #600150

    barisayarr
    Participant

    Hi there, thanks for your help.

    But this is not a workable solution. Each product will have its own unique link.

    #600292

    Hello,

    Try to use the theme preset feature of our theme for a single product page.
    Here is our documentation on how to use theme presets. https://xtemos.com/docs-topic/theme-settings-presets/

    Best Regards

    #600302

    barisayarr
    Participant

    This question has been asked by many people. It has not been fully answered. They don’t exactly meet my needs.

    First of all, I managed to create a demo button for each product with the code below.

    add_action('woocommerce_product_options_advanced', 'product_data_metabox');
    
    function product_data_metabox()
    
    {
    
        echo '<div class="options_group">';
    
        woocommerce_wp_text_input(array(
    
            'id'                => 'demo_url',
    
            'value'             => get_post_meta(get_the_ID(), 'demo_url', true),
    
            'label'             => 'Demo URL',
    
            'description'       => 'The button link'
    
        ));
    
        echo '</div>';
    
    }
    
    add_action('woocommerce_process_product_meta', 'save_field_on_update', 10, 2);
    
    function save_field_on_update($id, $post)
    
    {
    
        update_post_meta($id, 'demo_url', $_POST['demo_url']);
    
    }
    
    function content_after_add_to_cart_form()
    
    {
    
        global $product;
    
        $demo_url = $product->get_meta('demo_url');
    
        if (!empty($demo_url)) {
    
            echo '<a class="single_add_to_cart_button button alt" href="' . esc_url($demo_url) . '" target="_blank">Demo</a>';
    
        }
    
    }
    
    add_action('woocommerce_after_add_to_cart_form', 'content_after_add_to_cart_form', 10, 0);

    using this code, I can create a custom live preview button for each product from the product page. But I am having trouble aligning the button I created.

    I made the class of the “live preview” button the same as the class of the “add to cart” button. How can I get this button I created next to the “add to cart” button.

    • This reply was modified 9 months, 3 weeks ago by barisayarr.
    Attachments:
    You must be logged in to view attached files.
    #600370

    barisayarr
    Participant

    All the threads opened after me are answered, this thread is not answered. In which order are the answers given? If it is out of your scope of support, tell me and I will look for my answer on platforms like stackover.

    #600408

    Hello,

    Sorry but Additional code customizations are out of our theme support scope. Please share the page URL so i will check and give you the custom css code of this demo button.

    Best Regards

    #600517

    barisayarr
    Participant

    I will turn off the “buy now” button in the settings, I turned it on to show it.

    I want to get the “view demo” button instead of the “buy now” button. it would be much better if the “view demo” button could be shown instead of the “add to cart” button first

    The page and login information is in the hidden section.

    Attachments:
    You must be logged in to view attached files.
    #600652

    barisayarr
    Participant

    Reminder

    #600745

    Hello,

    Please try to use the below custom CSS code:

    .wd-single-add-cart>div>*:last-child, .wd-single-add-cart>*:last-child {
        margin-bottom: 0;
        display: flex;
        margin-left: 2%;
    }

    Best Regards.

Viewing 10 posts - 1 through 10 (of 10 total)