First: you’re using =
which assigns a value; use ==
to compare the values (or ===
to compare strictly, ie, match both the value and the type).
Second: Your code snippet shows that you’ve mismatched the "
s in the array, which should probably result in a PHP fatal error. I’m assuming that’s an error in the posted code but not in your production code.
Finally: your comparison will only work if $product_tag->slug
matches the entire array shown. If you only want to check if $product_tag->slug
matches one of the items in the array, you’ll need to use in_array()
.
eg:
if ( in_array( $product_tag->slug, ["TAG1", "TAG2", "TAG3"] ) ) {
$img_url = get_option( 'z_taxonomy_image' . $product_tag->term_id );
$this->format_setting( $product_tag->name, $img_url, $product_tag->term_id );
}
Related Posts:
- Disable Woocommerce product tags display by alphabetical order
- Display list of categories that contain products with a specific tag
- I can ‘t display product images based on the label
- How to show tag count for individual product post in wordpress woocommerce
- Retrieving Tag Name in Template Part from Filtered URL
- Hide a product with a certain tag from product-category
- How to display WooCommerce product tag names on home and category pages
- Get all categories inside a Product Tag archive page
- Can I create categories or attribute contain more than 70,000?
- Add “new” tag for existing products
- Remove link for Woocommerce product tags
- How to get current product category ID in product archive page
- WP/WooCommerce REST API cart/checkout/order [closed]
- Fatal Error when installing woocommerce despite upgrading
- Adding an action within a function that is being called by add_filter
- Hide Add to Cart Button
- Pass custom Checkout field value to Stripe gateway in WooCommerce
- How to modify “[Product] has been added to your cart” in WooCommerce?
- woocommerce fail to replace template string in email title [closed]
- Why do Woocommerce templates use hooks rather than get_template_part
- Woocommerce checkout via external page [closed]
- Change font size in products listing pages in woocommerce
- Trying to disable slider for WooCommerce price filter [closed]
- Hide “Delete Note” link in Order Notes Panel
- Woocommerce reviews xss issue [closed]
- Unable to update Woocommerce Product Permalink
- How to select default Woocommerce category page
- Creating Product Table using Gutenberg
- SKU for each product on every page
- Woocommerce get billing state manually
- WooCommerce quick checkout form? [closed]
- woocommerce cart item remove ajax not working in hosted site [closed]
- Set woocommerce product price based on dealer location [closed]
- How can I custom order the product display?
- WordPress plugin cloak link [closed]
- WooCommerce slider filter for numerical attributes
- Woocommerce Update Causing Internal Server Error [closed]
- remove default pagination on woocommerce shop page
- WordPress Comment Box on woocommerce product page [closed]
- Remove Bulk Action For non admin user
- Add max-value to hooked quantity selector in woocommerce [closed]
- woo product , wp_insert_post() never displays on the front end. What gives? [closed]
- Single product page doesn’t display price
- Should I use docker in wordpress production?
- Unable to paste google analytics con header.php [closed]
- can’t get the product id in single woocommerce page
- Php echo woocommerce price
- Different files for order details
- WooCommerce get_author_posts_url() – Author URL redirecting to shop base
- Error message if user is buying less than 200 euros of a given product [closed]
- Woocommerce – How to mix products and posts on a landing page?
- Disable woocommerce product search plugin’s autocomplete [closed]
- WooCommerce Subscriptions: Hide one variation subscription
- Contact form 7 send product PDF after submit
- Add sub variations in product page
- Woo commerce product quantity wise SKU
- How to access WC()->cart in CF7 hook wpcf7_special_mail_tags
- How to integrate e-transfers with checkout in WooCommerce
- Manual Admin Orders search for billing_company
- Use woocmmerce function on theme and override them
- Send all emails to Shop Manager along with admin
- Snippet to copy product affiliate link to a custom field
- Woocommerce Checkout Page Total Price Inside Google Pay Script
- I need help with storefront theme shop page
- How to get rid of variations with unspecified attributes
- Woocommerce shop page not showing all products
- Wrong Billing Information in WC_Checkout->get_checkout_fields(‘billing’)?
- How to display two different custom taxonomy terms on a WooCommerce single product page
- Registration roles
- Change password notification email
- How to show price update date in product single page?
- Woocommerce Rest API: woocommerce_product_invalid_image_id
- how can my customers view their purchased products history like an invoice in a specific page on WordPress
- How do I make my products on the homepage responsive?
- How to get users data from wordpress woocomerce database to display
- Simple thing esc_url query
- Woocommerce on Subdirectory
- Change WooCommerce state and city checkout fields to dropdowns related to the chosen country
- How to apply a custom coupon to a WooCommerce Subscription recurring amount?
- How to customize product at cart page
- WooCommerce Storefront site-header padding
- WooCommerce: How can I add a certain product to the cart and redirect to the cart from a non-shop page?
- Make Woocommerce breadcrumbs show up using functions.php file
- Alter the cost of products using phpmyadmin sql query
- How to check which shortcode is using my template?
- Update products with curl (bash)
- How to get woocommerce integration instance?
- Create woocommerce order on new user registration
- How to put a date range in a virtual/downloadable product? [closed]
- Categories and Tags Conflict after Woocommerce Installation
- Stop the “upload file size” error from printing [closed]
- Redirect whole website or pages to /wp-admin in wordpress
- Changing sale price programmatically, but it’s not shown on front-end
- Storefront Child Theme show product attribute [closed]
- How to remove slug from Product category URL in Woocommerce
- Removing ‘woocommerce-no-js’ class from body
- url rewrite doesn’t load woocommerce product
- Create WordPress account on different domain when WooCommerce order completed
- Creating a woocommerce order when a user creates an account
- I want to update shipping charge $0 for all Woocommeerce Subscription auto-renewal orders