lukasjan123
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce Payment Gateway - Paysera] Stock reduced twiceThank you! Will try with your settings and see how it goes.
Forum: Plugins
In reply to: [WooCommerce Payment Gateway - Paysera] Stock reduced twiceHey,
I can see that in 2.5.9 update changes were made to wc_maybe_reduce_stock_levels($order_id) instead of wc_reduce_stock_levels($order_id) at 267 in class-wc-paysera-gateway.php.
@algoritmika does stock reduction work fine for you after this update?
I previously had some workarounds, which kind of worked but are no longer working after current update.
How are you handling stock reduction? What are your paysera woocommerce settings under “u?sakymo būsena” tab?
Do you have custom code to handle stock reduction?
Because I have some issues, where customers abandon cart and I still get stock reduction, which is not automatically incremented back and has to be manually reset.
Also, sometimes when order is successfully completed, stock is reduced twice.
Hope you can help out,
Lukas
Hi Alex,
Thank you, it works now!
Lukas
Hi Alex,
Maybe that would be a better way, but I am not sure how I could accomplish that with your provided hooks.
I wanted it to run only when exporting orders because I am not using this custom field anywhere else.
However, when I add my provided custom php code to your plugin php snippet area, website server breaks when running export.
Could there be an issue with the methods used in my code?
This is the custom plugin export field I am trying to modify when exporting: https://ibb.co/g9mns7W
Lukas
Forum: Plugins
In reply to: [WooCommerce] Woocommerce stock reduction problemGlad to hear that.
However, I want to notify you that with this solution we have recently had a couple of issues. Some clients were redirected from payment gateway to our wordpress store unsuccessful payment page, though payment was successfully completed and we have received the money. I think it is like this because of payment status going to “failed” because we did not have this issue when all payment statuses first went to “on-hold” status.
I have made changes for all orders to go back to “on-hold” status and will try to figure out another way to fix this issue.
Forum: Plugins
In reply to: [WooCommerce] Woocommerce stock reduction problemThis was probably a problem with my payment gateway and order statuses changing from on-hold to processing.
Solved this by making all orders go to failed status and change to processing when payment is received. Also changed the code above to
// Woocommerce do not reduce stock on hold // add_filter( 'woocommerce_can_reduce_order_stock', 'wcs_do_not_reduce_onhold_stock', 10, 2 ); function wcs_do_not_reduce_onhold_stock( $reduce_stock, $order ) { if ( $order->has_status( 'failed' ) && $order->get_payment_method() == 'paysera' ) { $reduce_stock = false; } return $reduce_stock; } add_action( 'woocommerce_order_status_changed', 'order_stock_reduction_based_on_status', 20, 4 ); function order_stock_reduction_based_on_status( $order_id, $old_status, $new_status, $order ){ // Only for 'processing' and 'completed' order statuses change if ( $new_status == 'processing' || $new_status == 'completed' ){ $stock_reduced = get_post_meta( $order_id, '_order_stock_reduced', true ); if( empty($stock_reduced) && $order->get_payment_method() == 'paysera' ){ wc_reduce_stock_levels($order_id); } } }
This works, thank you!
Hello,
Ohh… Sorry, man for wasting your time. Somehow missed that.
Thanks!
Figured it out. Sorry for bothering.
Problem was custom single page layout, woocommerce price shortcode was not added to this layout.
Thank you, but this did not resolve the issue. Price is still not visible.
https://www.mhealth.lt/ – this website does not have this problem I just showed you it as an example that it displays simple product prices in landing pages where prices are set. You are correct the page you mentioned has price set to 0.
However,
https://www.mhealth.eu.com/en/product/zen-capsule/ – this website does not display simple product prices in landing pages and prices are definitely set. The price of this simple product is set to 6.90 you can see that when you add it to cart.
Yes, I do have prices set on those items, when you add it to cart you can see the price 6.90.
The problem is that price should be also visible on a landing page above add to cart button, on the right side of woocommerce product picture.
For example this page here displays simple product price on a landing page:
https://www.mhealth.lt/produktas/mobilus-eteriniu-alieju-difuzorius/Thanks Alex,
This worked!