Jump to content

Adding A Buy Now Button That Redirects To Order Page


Recommended Posts

Hello everyone im trying to add a buy now button to my side that adds the product to cart and goes straight to order page. 

{assign var='productLink' value=$product.url}
{if isset($static_token)}
    <a class="buy-now-button" href="{$link->getPageLink('cart', false, NULL, "add=1&id_product={$product->id|intval}", false)|escape:'html':'UTF-8'}">
        Buy Now
    </a>
{else}
    <a class="buy-now-button" href="{$link->getPageLink('cart', false, NULL, 'add=1&id_product={$product->id|intval}', false)|escape:'html':'UTF-8'}">
        Buy Now
    </a>
{/if} 

I tried this and it works , only problem is it redirects with an url https://mydomain.com/cart?add=1&id_product=1314&token=xxxxxx like this. now when i remove an product from cart it for some reason breaks.

also i want it to redirect to order page but for some reason it wont work.

Im doing this by adding to a TPL Block that my theme allows to do.

Link to comment
Share on other sites

Hi,

Could you kindly provide the specifics of the code you're utilizing for the redirection process?

Additionally, it would be helpful if you could share your Store URL so that we can examine the issue directly on your platform.
If feasible, could you also provide a video demonstrating the problem you encounter when attempting to remove a product from the cart, with the network tab opened?

Looking forward to your response.

Link to comment
Share on other sites

16 hours ago, Knowband Plugins said:

Hi,

Could you kindly provide the specifics of the code you're utilizing for the redirection process?

Additionally, it would be helpful if you could share your Store URL so that we can examine the issue directly on your platform.
If feasible, could you also provide a video demonstrating the problem you encounter when attempting to remove a product from the cart, with the network tab opened?

Looking forward to your response.

{assign var='productLink' value=$product.url}
{if isset($static_token)}
    <a class="buy-now-button" href="{$link->getPageLink('cart', false, NULL, "add=1&id_product={$product->id|intval}", false)|escape:'html':'UTF-8'}">
        Buy Now
    </a>
{else}
    <a class="buy-now-button" href="{$link->getPageLink('cart', false, NULL, 'add=1&id_product={$product->id|intval}', false)|escape:'html':'UTF-8'}">
        Buy Now
    </a>
{/if} 

The code works but unable to remove products. 

17 hours ago, Knowband Plugins said:

Additionally, it would be helpful if you could share your Store URL so that we can examine the issue directly on your platform.
If feasible, could you also provide a video demonstrating the problem you encounter when attempting to remove a product from the cart, with the network tab opened?

So what happens is url changes to https://something.com/cart?add=1&id_product=1303&token=88e54a39a424c2807b89f316edf3f115 and when the product is removed it does not get removed. but if the page url changes to https://something.com/cart?action=show and then it does get deleted. i can provide you the store URL but the button is not live . im pasting the code in the TPL Block of the theme . thanks for your help , video attached

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...