Ugur
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] How to add order status class to the body tag?I fixed it according to my needs such as:
add_filter( 'body_class', 'order_class'); function order_class( $orderclasses ) { // bail if Memberships isn't active if ( ! function_exists( 'wc_memberships' ) ) { return; } if ( wc_memberships_is_user_active_member( $user_id, 'uye' ) ) { $user_id = get_current_user_id(); // The current user ID // Get the WC_Customer instance Object for the current user $customer = new WC_Customer( $user_id ); // Get the last WC_Order Object instance from current customer $last_order = $customer->get_last_order(); $order_id = $last_order->get_id(); // Get the order id $order_data = $last_order->get_data(); // Get the order unprotected data in an array $order_status = $last_order->get_status(); // Get the order status if (is_account_page()) { $orderclasses[] = $order_status; } return $orderclasses; } }
Forum: Plugins
In reply to: [WooCommerce] How to add order status class to the body tag?Both your solution @rur165 and mine cause a fatal error when the user has no order or/and not logged in. Do you have a solution for that? Thanks
Forum: Plugins
In reply to: [WooCommerce] How to add order status class to the body tag?Thank you @rur165
The usage of the is_wc_endpoint_url would help me on the next move thanks for the help.
I fixed my problem via the last order with the above structure that I have added.Cheers.
Forum: Plugins
In reply to: [WooCommerce] How to add order status class to the body tag?It does the trick
add_filter( 'body_class', 'order_class'); function order_class( $orderclasses ) { $user_id = get_current_user_id(); // The current user ID // Get the WC_Customer instance Object for the current user $customer = new WC_Customer( $user_id ); // Get the last WC_Order Object instance from current customer $last_order = $customer->get_last_order(); $order_id = $last_order->get_id(); // Get the order id $order_data = $last_order->get_data(); // Get the order unprotected data in an array $order_status = $last_order->get_status(); // Get the order status if( is_page( 30 )) { $orderclasses[] = $order_status; } return $orderclasses; }
Forum: Plugins
In reply to: [WooCommerce] How to add order status class to the body tag?I was very hopeful about this snippet but it didn’t happen, what am I missing here?
add_filter( 'body_class', 'order_class'); function order_class($orderclasses) { $order = wc_get_order( $order_id ); $order_status = $order->get_status(); if( is_page( 5674198 )) { $orderclasses[] = $order_status; } return $orderclasses; }
Forum: Plugins
In reply to: [WooCommerce] How to add order status class to the body tag?It did not work well ?? what am I missing here
add_filter( 'body_class', 'custom_class' ); function custom_class( $order_status ) { if( is_page( 5674198 ) ) { $order = wc_get_order( $order_id ); $order_status = $order->get_status(); } return $order->get_status(); }
- This reply was modified 3 years, 9 months ago by Ugur.
Forum: Plugins
In reply to: [WooCommerce] How to add order status class to the body tag?Thanks, @rur165
It’ll help me a lot. By the way, I will add this class for only my account page and its children. I hope is_page( $page = ” ) will help.Forum: Plugins
In reply to: [iyzico WooCommerce] Woocommerce Taksit Komisyon Hatas?Bu asl?nda hatal? translation durumu. Taksitli sat?? komisyonu demek yerine taksit tutar? diye ?evirmi?ler. String’in orjinali Installment Fee. Dil dosyas?ndan veya Loco translate plugini ile o string’in türk?e kar??l???n? düzeltin derim. Elbette stringin orjinali Installment Fee diye tutar da do?ru mu onu bilemiyorum. ?yzico panelden bir kar??la?t?rma yapman?z laz?m. E?er tutmuyorsa css ile bu de?erleri front-end’den gizlemek laz?m. Maillerden de elbette.
Forum: Plugins
In reply to: [iyzico WooCommerce] Sipari? ?zetinde Hatal? Taksit Tutar? BilgisiBu asl?nda hatal? translation durumu. Taksitli sat?? komisyonu demek yerine taksit tutar? diye ?evirmi?ler. String’in orjinali Installment Fee. Dil dosyas?ndan veya Loco translate plugini ile o string’in türk?e kar??l???n? düzeltin derim.
Thanks, but I was able to do this with this snippet.
function hide_shipping_methods( $available_shipping_methods, $package ) { $shipping_classes = array( 'some-shipping-class-1', 'some-shipping-class-2' ); $excluded_methods = array( 'free_shipping' ); $shipping_class_exists = false; foreach( $package['contents'] as $key => $value ) if ( in_array( $value['data']->get_shipping_class(), $shipping_classes ) ) { $shipping_class_exists = true; break; } if ( $shipping_class_exists ) { $methods_to_exclude = array(); foreach( $available_shipping_methods as $method => $method_obj ) if ( in_array( $method_obj->method_id, $excluded_methods ) ) $methods_to_exclude[] = $method; if ( $methods_to_exclude ) foreach ( $methods_to_exclude as $method ) unset( $available_shipping_methods[$method] ); } return $available_shipping_methods; } add_filter( 'woocommerce_package_rates', 'hide_shipping_methods', 10, 2 );
Forum: Plugins
In reply to: [iyzico WooCommerce] If a variation type product has zero priceSo is it fixed for version Version 2.0.1? I couldn’t find a clue in the change log.
Forum: Plugins
In reply to: [iyzico WooCommerce] price should be more than zeroCan you share the solution here so we can fix it on our end?
Our case: If there is a variable type product and if it has 0 prices (free) variation (like a trial period or “free membership”) iyzico assumes that order has 0 value even you try with a variation which has price value (like “pro membership”)Thanks.
Forum: Plugins
In reply to: [Safe SVG] “Pending Full Review”Thanks for the update @enshrined
It is working for me. I guess your issue related to the payment gateway compatibility. Which payment gateway do you use?