With WooCommerce, I have faced a problem on my code below: I have tried skip specific category from my loop. Product has been skipped but some remaining products are showing multiple times: How can I avoid this item name repetition on this loop? Answer The variable $product_cat_id is not defined in your code, so your if statement is always true.
Tag: wordpress
WooCommerce product custom additional taxonomy in a loop issue
I am trying to display custom taxonomy field’s names and descriptions for single products in a loop. I’ve created custom product taxonomy next created sample tags: One, Two and assigned them to the Product (via ACF plugin) I want them to be displayed on product page. I was trying to use this code: but there is an issue I cannot
Woocommerce Additional Information Tab: Adding product custom field value
I have the following code working to create the Additional information tab in woocommerce with my own values however I want to pull the information from the built-in product custom field. This is the current code I use to output the custom field, how do I output this in Value 1 in functions.php file in the working code above? Answer
Change WooCommerce thankyou page title based on order status
Attempting to change the title of the thank you page based on specific order statuses, by combining a filter and action as follows: but I have tried multiple ways to combine the two and without any success. Answer You can use the following to change “Order received” page title based on order statuses: Code goes in functions.php file of the
Add the ean code (gtin) in the structured data of the product (Schema.org) in WooCommerce
I am using this snippet to display ean value for gtin in Woocommerce’s product schema: This works but I need to set “identifier_exists” markup to products that don’t have the custom field ean set. How can I modify my snippet to show the ean value in the markup if it exists, and add the identifier_exists attribute = false to products
Issue when adding product description at WooCommerce checkout
I’m trying to display the product description at WooCommerce checkout. I’m using: It takes the product short description and displays it below the product. It almost works perfectly, but it displays a colon (:) at the end of the description and the colon remains even if there is no short description. Result: I can’t figure out why it appears any
How to display sub field (image) with shortcode in WordPress?
These are the custom fields composition: 1 Group Footer 1.1 Group Col2 1.1.1 bbcimg (this is the image ID) 1.1.2 bbc-rss (this is the RSS feed ID) I have the following code displaying the bbc-rss: <…
Generate unique code every six hour with wordpress rest api
I want to generate 12 digit unique code with wordpress rest api which refresh every six hours. I didn’t find any code or method for my requirement. Example URL: ….domainname.com/wp-json/astra-sites/v1/get-last-unique-code Json code on above link: This code refresh every six hours. Please give me code or details to generate same code which refresh every six hours. I know how to
How to send an array of categories and posts in wordpress functions.php?
I make a request to my custom endpoint function in functions.php : add_action( ‘rest_api_init’, function () { register_rest_route( ‘wp/v2’, ‘/homepage/’, array( ‘methods’ => ‘GET’, …
wordpress template_directory in a link – php
In wordpress I try to work with the given syntax template_directory() for links. If I use the full path from root directory it works. $ptthlider_img_second = ‘/wp/wp-content/themes/theme_name/inc/img/…