Your cart is currently empty!
Issue with WC Product Rates Method
—
by
We have a problem with orders not completing when the following settings are in place.
Affiliates > Settings
– Default referral calculation : Referral Amount Method
– Default referral calculation value : Affiliates_WC_Method
Affiliates_WC_Method::product_rates
Affiliates > WooCommerce Integration
– [x] Enable product referral rates
– Default rate : .20
Products > edit a product > Product Data > Affiliates :
– Referral rate : Varies or is not set
Upon checkout, and only when a user has the wc_affiliates cookie, the WooCommerce waiting icon just spins forever.
The order completes on the back end, but not on the front end. The cart is not emptied. No referral is generated.
The following error is caught by the browser:
Request URL:https://staging.greensmoothiegirl.com/wp-admin/admin-ajax.php?action=woocommerce-checkout
Request Method:POST
Status Code:500 Internal Server Error
We didn’t see any error messages in the server logs, but one of my devs eventually tracked it down to this:
The problem ended up being here: https://staging.greensmoothiegirl.com/wp-admin/admin.php?page=affiliates-admin-affiliates&paged=0&action=edit&affiliate_id=497
The Affiliates plugin was running this query:
SELECT * FROM gsgWPaff_affiliates_attributes WHERE affiliate_id = 497 AND attr_key IN ('referral.rate','referral.rate.method','referral.amount','referral.amount.method')
which returned nothing because that table is empty. It doesn’t have any error handling in place to catch these, so the script just dies with that query and produces the 500 error.
He added an attribute to the affiliate record via the link above, and it allowed him to complete the checkout.
But, my understanding is User attributes are for overriding other settings. Correct? So, we don’t want to set a user attribute for every affiliate in the system.
Please advise. We’d love to be able to use the Product Rates method. Thanks!
Comments
One response to “Issue with WC Product Rates Method”
I’ve just placed a few test order through a new test affiliate’s link and no issue showed up.
Note that the query isn’t a problem, zero results are handled correctly for it by the system. Also it wouldn’t really be the cause of a 500.
Have you changed anything since then?