Coupon code discount on on product page
-
Hi Guys,
I am constantly looking for a solution to a basic problem.
The use case is.I want my clients to come to a website through a link that will include a coupon code like: http://www.domain.com/?add-to-cart=234&code=25OFF
Which will result in add a specific product to a cart and apply the sitewide coupon code for 25% off the regular price.The mechanism works – it adds the product and applies the reduction – but I can’t see the reduced price in the store – only on the checkout page.
The effect I would love to get:
1. Client comes through a customized link with a coupon code and see the reduced price on products selected in the coupon code and are visible across the shop without the product added to the cart.The issues i had come across:
1. You can’t apply a coupon code without a product in the cart (Resolved by adding a Coupon Code product that is being added through the customized link)
I have used this piece of code: https://stackoverflow.com/questions/48220205/get-a-coupon-code-via-url-and-apply-it-in-woocommerce-checkout-page2. After applying a coupon to a fake product – the shop prices are still regular and only reduced in the checkout process.
I have tried this piece of code: https://reigelgallarde.me/programming/show-discounted-price-product-page-using-coupons/It shows the reduced prices on the product pages but i get the error in the admin panel in products under price:
Fatal error: Uncaught Error: Call to a member function has_discount()
- The topic ‘Coupon code discount on on product page’ is closed to new replies.