Ripefruit

  • What We Do
    • Advertising
    • Publications
    • Web Design
  • About Us
    • In Progress
    • Not For Profit
    • Partners
    • Acceptable Use
    • Privacy Policy
    • T & C
  • Contact Ripefruit
  • Clients
    • Billing
    • Client Login
    • Resources
      • Friends
      • Service Status
    • Support
  • IT Talk
    • Domain Names
    • Hosting
    • Internet
    • Search
    • Services
    • Software
    • Technical
  • Contact Us
    • Contact Us
    • Site Map
You are here: Home / IT Talk / Technical / WooCoomerce: Buy Now + Affiliate Link + Cart – FIXED

WooCoomerce: Buy Now + Affiliate Link + Cart – FIXED

I was really quite pleased when I discovered a fix for this.

The issue was when you clicked on the BUY NOW button, instead of it taking the user to the affiliate website product page, it first took the user to the CART, then took the user to the affiliate website page.

In fact, the redirect acted differently on a PC and a Mobile.  On a PC browser the redirect took seconds, on a mobile it took longer.  If the user tried to return to my website (BACK), it then stuck on the CART page.

BEFORE

AFTER

So.. the 2 step fix

Overview: remove the WooCommerce Buy Now button and add a new BUY NOW button below the product description.

  1. Remove the BUY NOW button
  2. Add a new BUY NOW button

1. Remove the BUY NOW button

Add this code to functions.php

file = /public_html/wp-content/themes/<your theme>*/functions.php

* WP Admin – Appearance / Active theme

remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );

2. Add a new BUY NOW button

Add this code where you want the BUY NOW button to appear on the page..

<a class="btn btn-primary" href="{url[1]}" target="_blank" rel="nofollow noopener">BUY NOW</a>

class="btn btn-primary" requires <a href="https://getbootstrap.com/" target="_blank" rel="nofollow noopener">Bootstrap</a> - it's fabulous!

NOTES

I use AllImport, so its a relatively easy to add the button html to the Template so the button appears with every imported product

<strong>{name[1]}</strong>
Brand: {brand[1]}
Store: <a href="{url[1]}" target="_blank" rel="nofollow noopener">{merchantcampaignname[1]}</a>
Price: {price[1]}
Sale Price: {pricesale[1]}

<a class="btn btn-primary" href="{url[1]}" target="_blank" rel="nofollow noopener">BUY NOW</a>

I also use bootScore which has fabulous CSS buttons – well worth checking out.

I hope it helps everyone!

Still stuck?  Now working for you?  Go here



Please LIKE or tell a friend..



Post Views: 1,443

Also See..


  • Listing | Link Removal
  • Missing ads.txt Earnings At Risk – FIXED
  • What is the best shopping cart?
  • Adobe Fireworks CS5 Internal Error – FIXED
  • Affiliate Marketing Australia | Networks & Partnership Platforms

Recent Posts

  • The end is near for Event Websites
  • Iphone XS: Missing Screens/Apps – FIX
  • MuleRun – The World 1st AI APP Store

About Brian King

Managing director and senior editor at Ripefruit Media

  • Email
  • Facebook
  • Twitter
  • YouTube

For Advertisers

  • Advertising FAQ
  • Contact Us
  • Content Changes
  • Website Network

IT Talk

  • The end is near for Event Websites
  • Iphone XS: Missing Screens/Apps – FIX
  • MuleRun – The World 1st AI APP Store
  • How We Solved a Encoding Issue (Thanks to ChatGPT)
  • Windows 11 Not Seeing Keyboard at PIN Login = Fix
  • WooCoomerce: Buy Now + Affiliate Link + Cart – FIXED
  • Why WP Engine Affiliate program migration from ShareASale to Everflow is a WASTE of time
  • how to hide nvidia pop up

Keywords

10 admin affiliation attack australian avg brute force business change domain name ebay email facebook fix form for sale fraud free google hosting how to htaccess ip ip address LastPass mobile mobile-friendly password Phishing pin plugin ranking removal remove scam security seo software spam toontown update website web site wordpress wpmu dev

SiteMap

  • About Us
  • Acceptable Use Policy
  • Advertising
  • Contact Us
  • Digital Publications
  • Domain Names
  • Email
  • Home Page
  • Hosting
  • Internet
  • Publishing
  • Software
  • Technical
  • Search
  • Services
  • Web Design
  • What We Do
  • About Us
  • Contact Ripefruit
  • Clients
  • IT Talk
  • Contact Us


Copyright © 2026 · Ripefruit

Ripefruit acknowledges and pays respect to Aboriginal and Torres Strait Islander Elders past, present and future. We commit to building a kind future for everyone.