Hi I am trying to display the child term of the current post category page. However I can figure out what am missing here. Thanks Answer In your code the taxonomy should be “category”, so your arguments for get_terms() should have “taxonomy” => “category”. $current_tax is irrelevant in this code then.…
Tag: wordpress
How to upsell product in woocoomerce based on last product’s variation
I hope someone with more coding knowledge nouse will know more on how to tackle this little upsell issue I have in WordPress. The idea is in a side cart, based on the last product’s variation, it will show an upsell product in the side cart. Currently I am using a Woo side cart plugin that displays a ra…
PHP if statement: Zero vs ’empty’
I’m creating a WordPress website using the Advanced Custom Fields plugin. I have a set of fields for tennis score results. In the template, I’m showing these fields like this: The problem is that some scores are zero, so they’re not showing up. I understand that this is because 0 basically e…
wc_order_query with meta_query not working when using relation
I am trying to use WC_Order_Query, to get all orders where a custom meta_key doesn’t exist, is empty or equal to 0 I’ve tried like a lot of the stuff documented on this site, but nothing seems to work. It just returns all content, which is the opposite of what i’m trying to do. This is what …
Move “review tab” to position output of product sharing on WooCommerce single product page
I want to change the position of the “review tab” to the position below the share button on the right I removed the default “review tab” with this code and it worked But I don’t know how to re-add the “review tab” under the share button. Any advice? Answer To change t…
Elementor Custom Widget Color Control does not work in live editing
I am working on a custom widget and I want to add styling configuration to the widget. One small problem that I found is that the color control in live editing does not work (It will work for preview and after save then reload). As shown below, Tab’s title and content font color does not change in live …
add a custom field on a specific product IDs woocommerce
I want to add a custom field “Product Description” on a specific set woocommerce products in functions.php. See below code: I don’t know what went wrong with the code as WordPress gives “There has been a critical error on this website.” Notice. I turned on WordPress Error Reporti…
WordPress: Add directory to post slug with function
I want to add a /news/ before every post slug. Like this: example.com /news/ post-slug/ If I add the /news/ in the permalinks settings, every custom post type is broken after it. I tried to add the following to every register_post_type: But that doesn’t help. I also tried the code from here: Unfortunate…
Why Woocommerce update price programmically not working in woocommerce_add_cart_item_data hook
i have 2 type of products : 1- products that have regulare price 2- products that have calculated price i added some hidden field to product page form with below code : and send these fields data to cart item by : and at last using woocommerce_before_calculate_totals hook to change product price by this code …
Add to cart validation based on product attribute in WooCommerce
I’m trying to add a filter when a customer adds a product to the cart, to allow it or not. We just need to compare one attribute of the WooCommerce products. If cart is empty : Add to cart ok If cart has 1 or more items : check Attribute XXX value of products If Attribute value is the same