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 display custom field in woocommerce orders in admin panel?
- How to create a custom order status in woocommerce!
- How to show product SKU on product page
- How to get woocommerce inventory status [closed]
- functions.php inject inline css
- Woocommerce add to simple product attribute programmatically [closed]
- Load post with a different template?
- Apply jquery script to only woocommerce product pages and categories
- In WooCommerce I need to modify the thankyou.php page [closed]
- Show/hide Widgets in Dashboard Based on Current Advanced Custom Fields Option
- How can I add an extra WooCommerce hook
- remove from text-widget
- How to Acheive the custom woocommerce category template
- The values of custom fields are not available functions.php
- Remove product description from product archive page
- 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
- Can you use admin pages functionality on the frontend of your site
- change billing and shipping address 1 and 2 field placeholders [closed]
- Creating loop within functions.php
- 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!
- Auto scroll to id on page load on all pages except home page. Only do this on mobile
- How add body_class from wp_termmeta
- Using two loops in one WordPress template
- Adding product to WooCommerce cart [closed]
- Change WooCommerce add_to_cart Button Text?
- WooCommerce -> wc_enqueue_js not working [closed]
- Use existing image sizes for WooCommerce
- Insert a field with PREG_REPLACE – strange behaviour
- Perform function on publish AND save (not just save)
- Display ACF category image on archive and single template files
- Woocommerce Variable Product Dropdown for Custom Shop Template
- Featured Image and Tags problem
- How to hide content on mobile in the functions.php file – woocommerce
- Woocommerce Default sorting product by product type
- How to hide WooCommerce product title and short description to non logged in users?
- Override a Post’s URL with Advanced Custom Fields Function
- WordPress Function Assistance with Loop
- 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
- Hide ‘add to cart’ when certain value in dropdown is selected
- How to update an image attachment’s alt text from a custom field when saving a post?
- removing description tabs – single product page – breaks footer
- ACF Fields are not showing up on Homepage
- Link product attribute value to a URL – woocommerce
- Remove text after a dot and a colon in Woocommerce product title
- 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
- Woocommerce product price change
- 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
- Reference multiple style sheets, clearing styles for permalink page, custom fields for css
- Variable function names
- Override plugin function to show invoices even if not logged in
- get_field() with ID in one signal filter not working
- Woocommerce – Switching Price for Category
- 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?
- add product thumbnail to checkout page only and include variation name
- Comment function for page
- ACF Filter return value
- Execute jQuery with custom event listener after successfully add an item to the cart
- Move product attributes after summary on single product page
- Which method is more correct for removing WooCommerce Extensions menu item?
- 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
- update_post_meta not working in function
- does acf_save_post cause endless loop?
- Call ACF data from functions.php [closed]
- Display post_meta-by_key on product catalogue
- Get term count on a category page
- Woocommerce – Checkout error message
- add variable to actions/functions across different files (woocommerce)
- reusing code in function and running it with loop
- Which template file to edit to edit homepage in Mystile [closed]
- “woocommerce_output_related_products” not working