New Landing How can we help? Themeforest Theme Support Uplift Can I create an "Add to Cart" button that adds a product to the cart on click?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Posted in: Uplift
  • #295854
    oriweb
    Member
    Post count: 24

    Hi,

    We’d like to create an “add to cart button” that adds a specific product and quantity to the cart upon click. Ideally we can create this in the page builder, but if we need to use html that’s fine.

    Is there a way to do that?

    Thanks!

    #296156
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    Woocommerce has a shortcode that allows to do that.

    You can add this shortcode inside the content of a text block from our page builder.

    [add_to_cart id="99"]

    replace the 99 by the id of the product, you can grab it in the edit link of the product.

    Hope it helps.

    -Rui

    #296748
    oriweb
    Member
    Post count: 24

    Thanks Rui!

    Is there any way to change the text of these buttons (ie: $29 – Add to Cart) ?

    #296763
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    In that case use instead this shortcode

    [add_to_cart_url id="99"]

    It will return you the url used to add to the cart for that product
    So you can build your custom html button.

    -Rui

    #297263
    oriweb
    Member
    Post count: 24

    I’m a bit confused. I added that bit to my button like so, but no luck.

    [sf_button colour="black" add_to_cart_url id="16276" type="bordered" size="standard" target="_self" icon="" dropshadow="no" rounded="yes" extraclass=""]$29 - Add to Cart[/sf_button]

    Or maybe I misunderstood what you intended?

    #297273
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    No, it doesn’t work that way.

    First of all you need to keep the brackets or it won’t work and you can place it inside a shortcode like you did it.

    It needs to be something like this.
    <a href="[add_to_cart_url id='14593']"> Click Me </a>

    You need to add it in the text mode inside a text block.

    -Rui

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

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register