Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buy Now Button gives a 404 Error for products that are listed on home page #39

Open
palashdrvaidyas opened this issue Aug 5, 2020 · 33 comments
Assignees
Labels

Comments

@palashdrvaidyas
Copy link

The issue is happening after the recent update in the version of 2.7.4. The buy now to checkout page functionality is working fine on product pages but on the products listed in the home page it is giving a 404 Error.

@welcome
Copy link

welcome bot commented Aug 5, 2020

Thanks for opening your first issue here! Be sure to follow the issue template!

@varunsridharan
Copy link
Owner

@palashdrvaidyas can you please share your website link to i can give it a try to understand the exact issue.?

@cliqer
Copy link

cliqer commented Aug 7, 2020

@varunsridharan I have exactly the same problem.

While using a direct link within a button in Home page to:
https://domain.com/quick-buy/productVariableSlug/qty
used to work, after latest update it doesn't and throws error 404 and have the below errors on the page.

Deprecated: add_to_cart_redirect is deprecated since version 3.0.0! Use woocommerce_add_to_cart_redirect instead. in /var/www/vhosts/cliqer.io/httpdocs/wp-includes/functions.php on line 5088
Deprecated: WC_Cart::get_checkout_url is deprecated since version 2.5! Use wc_get_checkout_url instead. in /var/www/vhosts/cliqer.io/httpdocs/wp-includes/functions.php on line 4713

Also if I install previous version the same happens so something must have been meshed up with the DB because only a full restore brings it back.

Of course tried everything I could think of like reset permalinks, php version 7.4-7.3, nginx-apache etc. but without any luck.

@cliqer
Copy link

cliqer commented Aug 7, 2020

@varunsridharan Can you please have a look as soon as possible as this is crucial on my case.
Many Thanks

@varunsridharan
Copy link
Owner

@cliqer

i just checked and it seems. it dosen't seems to be from my plugin.

Deprecated: add_to_cart_redirect is deprecated since version 3.0.0! Use woocommerce_add_to_cart_redirect instead. in /var/www/vhosts/cliqer.io/httpdocs/wp-includes/functions.php on line 5088
Deprecated: WC_Cart::get_checkout_url is deprecated since version 2.5! Use wc_get_checkout_url instead. in /var/www/vhosts/cliqer.io/httpdocs/wp-includes/functions.php on line 4713

my plugin uses the latest hooks provided by WooCommerce. may be it could be from some other plugin or may be you could have been using the older version of Quick Buy.

And i still can't replicate 404 Error!!

@cliqer
Copy link

cliqer commented Aug 7, 2020

@varunsridharan Thank you for looking at it.
Indeed these functions where some old custom injected functions on another plugin.
Unfortunately the redirection still doesn't work on my case.
Using oxygen and in the home page I have a button with the link posted before.
Putting the link on the browser window of course still does not redirect and throws 404
image
image

@cliqer
Copy link

cliqer commented Aug 7, 2020

@varunsridharan Please use this link to check yourself:
https://cliqer.io/quick-buy/starter-yearly/1

Cliqer.io

@varunsridharan
Copy link
Owner

@cliqer i think i found the issue. and this issue seems to be present in older version too and i am not sure how it worked for you before the recent update. anyways i will try to get this fixed asap and push an update.

@varunsridharan
Copy link
Owner

@cliqer sorry bad news. we never had slug feature completed in our plugin to use in the url. i would recommend you to use sku instead. !!!!

@cliqer
Copy link

cliqer commented Aug 7, 2020

@varunsridharan let me try and will report back.
Strangely it was working before update.

@cliqer
Copy link

cliqer commented Aug 7, 2020

@varunsridharan Tried sku and id, refreshed permalinks but the same happens.
https://cliqer.io/quick-buy/338/1?code=trial
BTW these are variations:
image

Any other ideas?
What is the plain permalink address of the plugin and its options to debug if it is a permalink problem on my end?

@varunsridharan
Copy link
Owner

@cliqer
give me some time. let me do some debug and get back to you. in a day

@palashdrvaidyas
Copy link
Author

palashdrvaidyas commented Aug 10, 2020

@palashdrvaidyas can you please share your website link to i can give it a try to understand the exact issue.?

@varunsridharan Hello
Sharing the staging link for my site https://stagherbuild.wpengine.com/
here you can check the Limited Time Offer Section. If you click the buy now it gives a 404 Page not found error. The other product pages are working fine.

@varunsridharan
Copy link
Owner

@palashdrvaidyas thanks for sharing the dev / staging site. well i just checked the page you said. and it seems to be that the permalinks are not updated properly.
can you try updating your permalinks ?
Also do you have any cache enabled ?

@palashdrvaidyas
Copy link
Author

@palashdrvaidyas thanks for sharing the dev / staging site. well i just checked the page you said. and it seems to be that the permalinks are not updated properly.
can you try updating your permalinks ?
Also do you have any cache enabled ?

Hello @varunsridharan I have already tried updating the product permalink nothing worked for me. Yes I am using cache plugin Fast Velocity Minify on my site plus server-side caching is also enabled.

@cliqer
Copy link

cliqer commented Aug 18, 2020

I just ditched the plugin and used:

/checkout?add-to-cart=338&code=trial

as the link on the button.

Thank you for this @varunsridharan; it was great while it lasted but unfortunately doesn't work any more.

@varunsridharan
Copy link
Owner

@cliqer sorry that i am not able to solve the issue.

the thing right now is that i am not able to replicate the same issue anywhere else in my setup and the end users are not ready to share a test site to debug the issue. :-(

@varunsridharan
Copy link
Owner

varunsridharan commented Aug 19, 2020

@cliqer @palashdrvaidyas

i have created a new Word Press site and installed WooCommerce & Quick buy.

still am not able to replicate it.

can you guys help in this ?

site at http://***************/
Username: ***************
Password: ***************

@palashdrvaidyas
Copy link
Author

palashdrvaidyas commented Aug 19, 2020 via email

@varunsridharan
Copy link
Owner

@palashdrvaidyas i have given you the admin access and do what ever changes you need to do.

so that i can get debug and find whats wrong with your type of config or if its with my plugin.

@rafflestore
Copy link

rafflestore commented Aug 21, 2020

This issue is also occurring on a number of our websites. It had previously been working fine, but I was alerted by a client that first noticed it happening on Wed 12 August 2020. The [BUY NOW] button on the product pages work fine, but clicking the [BUY NOW] button on the home page gives an error "No Results Found. The page you requested could not be found. Try refining your search, or use the navigation above to locate the post." and the URL generated by the button is https://lakesidecc.online/buy-now/713/1 or similar. That is https://lakesidecc.online/buy-now/{id}/{qty}

@rafflestore
Copy link

I have modified your test WordPress site to demonstrate the issue. It occurs when the WooCommerce/Settings/Products/Shop page=Homepage. Clicking on any of the Red [BUY NOW] buttons on the home page will cause the error 404 to trigger.

@varunsridharan
Copy link
Owner

@rafflestore thanks will have a look @ it in a day max.

@palashdrvaidyas
Copy link
Author

Hi @varunsridharan even i have enabled the buy now in the home page on clicking, its giving a 404 error. Hope this is fine for you to debug the issue.

@felini
Copy link

felini commented Aug 21, 2020

In my case, I changed the option URL Endpoint to 'cart?add-to-cart={id}' and solve my problem for now.

Just a tip to don't appear 404 error while the fix is not solved.

cart?add-to-cart={id}

@varunsridharan
Copy link
Owner

@felini @palashdrvaidyas @rafflestore @cliqer thanks for your support.
i found the issue and pushed an update please do let me know if there are still issues.

@varunsridharan
Copy link
Owner

@felini @palashdrvaidyas @rafflestore @cliqer
please do update permalinks once again after you update the plugin.

@alephart
Copy link

Hi varunsriddharan,

I have this config in my site:

image

Please view Home URL (is the final URL of my Site) and Site URL (is Wordpress URL)...

Quick Buy Shoe this URL endpoint:

image

But that is not de final URL and generated error 404 page. The final url should be: https://cawel.co/finalizar-compra/{id}/{qty}

Already update the permalinks. I don't have any cache plugin, I already uninstalled Quick Buy and reinstalled it.

How can I solve that the endpoint url is, my Home URL and not the Site URL?

@varunsridharan
Copy link
Owner

@alephart are you using the latest version of Quick Buy?

Can you share the version number. and once you have updated the plugin you have to save the settings once again and try to update the permalinks

@alephart
Copy link

@varunsridharan sure see:

image

I had already installed and updated the permalinks ... it doesn't work.

@varunsridharan
Copy link
Owner

@alephart weired !!! would you mind sharing site access to debug / can you share screenshot of all the settings options from our plugin ?

@alephart
Copy link

@varunsridharan ready, i create an account with your email...

This screenshot settings:

image

image

image

image

Options General:

image

Permalinks:

image
image

@varunsridharan
Copy link
Owner

varunsridharan commented Aug 25, 2020

@alephart

Thanks for supporting this plugin by providing access to your site :-)

Well i was able to check and figure out the issue but not a proper fix for it yet.

Let me explain on whats going on (its a note to myself to )

  1. I found your site is WPMU which we haven't tested

  2. your site seems to be located inside a folder eg : https://example.com/your-website instead of https://example.com/your-website
    Note To Self which means i need to make sure the sub folder is getting registered properly with wordpress when adding rewrite rule ( https://github.com/varunsridharan/woocommerce-quick-buy/blob/master/includes/class-url-endpoint.php#L39-L42 )

  3. Quick fix would be to manually insert the sub folder in URL Endpoint Field. thus making it work.

GitHub
Add Quick buy button to redirect user to checkout / cart immediately when he click quick buy button - varunsridharan/woocommerce-quick-buy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants