You can check if the get_field()
comes up empty by doing
if ( get_field('pack_quantity') ) {
//Your code
}
So something like this should work if you just need to check one of the fields.
add_action( 'woocommerce_single_product_summary', 'my_custom_fuction');
function my_custom_fuction() {
if ( get_field('pack_quantity') ) { //Change this for which one you need to check
echo 'Pack Quantity: ' . get_field('pack_quantity');
echo'';
echo 'items per: ' . get_field('per_pack');
}
}
https://www.advancedcustomfields.com/resources/hiding-empty-fields/
Related Posts:
- Echo a String Based On Geolocation? [Woocommerce || ACF]
- How to get woocommerce inventory status [closed]
- functions.php inject inline css
- Apply jquery script to only woocommerce product pages and categories
- Show/hide Widgets in Dashboard Based on Current Advanced Custom Fields Option
- How can I add an extra WooCommerce hook
- How to Acheive the custom woocommerce category template
- Hide some items from Screen options in dashboard for products
- display 100 products per page on product category page [closed]
- Adding WooCommerce to a Custom Theme – not working [closed]
- Issue adding text after short description on product pages Woocommerce [closed]
- Exclude Empty Child Categories in Menu
- change billing and shipping address 1 and 2 field placeholders [closed]
- Creating loop within functions.php
- Override woocommerce wc-class function
- How to use max and min values of custom fields
- woocommerce target button with class after ajax update
- WordPress function for 1 to for many
- Pass parameters to function through an action
- Product Tags in Add New product as checkbox list [closed]
- Calling a function from anywhere, used in different places
- Selective Product Category for Carousel
- Run function when WordPress new multisite is created or ACF field is updated
- I want to get product attirbute in the section below
- Having issues with a foreach inside of a shortcode with ACF gallery
- Load Woocommerce and WordPress Functions Outside
- How to add a slide toggle to the Woocommerce-Layout__Activity-Panel area in the orders admin page
- Get Current Post ID in functions php, meta query filter
- Add to cart php not working [closed]
- How to auto refresh when user change postcode
- When sale price is 0.00 show only regular price
- Remove the product category module block from the Woocommerce product page
- how can I edit flexslider in woocommerce. [Urgent]
- woocommerce change currency per category [closed]
- Redirect to another page using contact form 7? [closed]
- ACF not showing
- help I changed one currency in woocommerce and everything is ruined [closed]
- How to override woocommerce.css?
- How can I use Woocommerce $product->get_attribute in functions.php? (if at all)
- How to retrieve the values of a sub-field in the first and last row of an (ACF) repeater inside function?
- (Woocommerce) Order by price when entering specific category
- Access category within rss2_head hook?
- Create custom function for hero image
- Can set_post_thumbnail be used to remove a thumbnail?
- add_filter to specific WooCommerce Category
- Programmatically add Yoast meta description after post save
- Woocommerce checkout field
- Compare meta key to current date in pre get post
- Woocommerce image sizes missing from Appearance › Customize but not declared by theme
- Way to redirect all Product Sub Category to its Main category Page?
- Add Login/Logout Menu Item to Primary Nav “My Account” Submenu [Woocommerce] [closed]
- Create a Woocommerce product widget with category filter
- Delay a function, any function!
- How add body_class from wp_termmeta
- Using two loops in one WordPress template
- Change WooCommerce add_to_cart Button Text?
- Perform function on publish AND save (not just save)
- Woocommerce Default sorting product by product type
- How to hide WooCommerce product title and short description to non logged in users?
- How to show ACF value under post/page title in wp-admin
- How to display an image before title text in menu items
- How to add custom metakey to shop_order page’s searching function?
- localize_script but data changes dependent on product ID
- Changing the HTML of notices in WooCommerce [closed]
- Filter works on last selection but no others
- Change class woocommerce on function.php
- Show ‘Add to Cart’ on Out of Stock products
- removing description tabs – single product page – breaks footer
- Link product attribute value to a URL – woocommerce
- When are the user meta fields created in the database? Admin vs Woo API REST
- price of product can’t return when get data of product in functions.php
- Remove clickable Link of WordPress Site Logo from Woocommerce Single Product page
- is_product_category(‘Services’) not working
- Problems adding a new field to product in cart
- Parent category as WOOCommerce Categories widget title
- Woocommerce Display Discount On cart
- Problem with my footer after changing WooCommerce Products Sorting [closed]
- ACF Date Form in Custom Admin Field
- Assign IDs to headings in ACF using functions.php
- Variable function names
- Override plugin function to show invoices even if not logged in
- how can I change the read more link destinations and direct all to the same page?
- Woocommerce custom calculation function
- button to toggle css styling / div visibility?
- ACF Filter return value
- Execute jQuery with custom event listener after successfully add an item to the cart
- Show number of sold products but be first for less than 2
- function syntax is off,
- Return ACF Field value function
- Providing fallback function and allow override by plugin
- Different body image backgrounds on different pages, posts and categories
- Insert menu into theme location depending on user logged in/out status
- Call ACF data from functions.php [closed]
- Display post_meta-by_key on product catalogue
- Woocommerce – Checkout error message
- Which template file to edit to edit homepage in Mystile [closed]
- “woocommerce_output_related_products” not working
- woocommerce_sort_product_tabs() expects an array
- sort by date in users
- Is it possible to set the first image from a gallery as the product image, rather than the featured image?