Ripefruit

  • About Us
    • About Us
      • Acceptable Use
      • Privacy Policy
      • T & C
    • Contact Ripefruit
    • In Progress
    • Not For Profit
    • Partners
  • What We Do!
    • Advertising
    • Publications
    • Web Design
  • 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: 979

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

Recent Posts

  • 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

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

  • 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
  • Facebook Wishlist: Edit Featured Pin’s
  • What is the best shopping cart?
  • file explorer not responding FIX

Keywords

admin affiliation attack australian avg brute force business cache change domain name ebay email facebook fix form for sale fraud google hosting how to htaccess image ip ip address LastPass mobile password Phishing pin plugin ranking removal remove responsive scam security seo software spam toontown web site website Wordfence 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
  • About Us
  • What We Do!
  • Clients
  • IT Talk
  • Contact Us


Copyright © 2025 · 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.