This code will allow you to display the upload form when the product is in the $special_category
product category.
add_action( 'woocommerce_before_add_to_cart_form', 'display_additional_product_fields', 9 );
function display_additional_product_fields() {
global $product;
// Product category or slug that will allow the upload field to be displayed.
$special_category = 314;
if ( ! has_term( $special_category, 'product_cat', $product->ID ) ) {
return;
}
?>
<p class="form-row validate-required" id="image" >
<label for="file_field"><?php esc_html_e( 'Upload Image:', 'text-domain' ); ?>
<input type="file" name="image" accept="image/*">
</label>
</p>
<?php
}
Related Posts:
- How to display custom fields as table in Woocommerce
- Retrieve Product category ‘NAME’ by product category ID – WooCommerce?
- Order get_terms() By Custom Field
- get_field not displaying my custom field value
- Programmatically create product category and add thumbnail in woocommerce
- Create product category and keyword search form in woocommerce? [closed]
- Need help adding custom field to category
- Custom query with category exclusion and post-meta “whitelist”
- How do I edit pre_get_post for the category the user is currently in?
- Use get_term_children to get the sub category of a parent category for the current post
- Hide uncategorized products from the shop page
- Remove word “Category” from WooCommerce product page [closed]
- Filtering search results
- WooCommerce change category url and product base
- Output link to category from WP_Query loop of woocommerce products
- Filter out posts before display category count
- Add custom taxonomy under the category title
- How to get product count with respect to categories in WooComerce
- Get woocommerce catogry
- Set post categories to include parents when setting child category
- Linking products to categories
- Warning: sizeof (): Parameter must be an array or an object that implements Countable, On products pages
- Omit specific product categories from WooCommerce shortcode
- Multiple Domain Names – One WP Install (non-Multisite) – Default Each Domain name to Product Category WooCommerce
- How to call custom category field data in theme?
- Hide woocommerce category name from specific pages
- How to redefine the sorting of product categories by menu_order?
- How to change a post category when the ACF datepicker Field is today
- Pagination is not working properly in Product Category/Tag pages
- Best way of getting WooCommerce category path
- How to recreate a copy of a product category in WooCommerce? [closed]
- Get parrent category name
- Sorting category products not working
- Change thumbnail image depending product category
- Listing Texts of Which Custom Field is Null
- How to query categories with Advanced Custom Fields?
- Redirect to another page using contact form 7? [closed]
- Categories are not listing their respective products
- How to add custom color fields to the category edit page?
- Display single category name in woocommerce loop
- Building Menu from Woocommerce Product Categories
- woocommerce related products by specific categories [closed]
- List just subcategory and products of active category page in Woocommerce
- why get_the_post_thumbnail( the_ID()) echos extra post id
- Filter WooCommerce archive pages by an additional category
- Custom tax_query filter not working for Woocommerce product categories
- How do order product categories – on a parent category page – in Woocommerce?
- Remove any product that is featured from regular display loop [WooCommerce]
- Two Sections on Woocommerce Catergory Page [closed]
- Woocommerce search form with category select
- Template for product-category page [closed]
- Displaying a custom field in Category Archives
- Custom Fields Value As Taxonomy
- Update custom category fields front-end
- What is the best way to add an advanced / intermediate / beginner tag to a post
- Adding tinymce to Custom Field boxes on Category edit page
- displaying the last product comment in the woocommerce category
- Displaying Single Product Page Parent and Child Category
- Woocommerce only display child category when parent is checked (on add new product page)
- Conditional label Woocommerce archive [unsolved]
- Show audio player only in specific post type category
- How to make product image inherit from category image
- How to target all woocommerce categories that don’t have any subcategories in them?
- In if…else condition, the else statement shows even if if statement is correct
- How to show WooCommerce Categories on ‘shop’ page instead of products?
- How can I display all products from all categories on one page with woocommerce?
- How to edit woocommerce sub-category page
- Modifying category order
- Is there a reason to put a product in both the Child and Parent Categories?
- WordPress category title not update in navigation menu
- How can I add different custom fields for each category in the same post?
- WooCommerce showing active product categories on single product page
- selecting categories that have products with tag/category
- Restrict retrieved terms by category?
- How to modify custom category field from front end?
- Woocommerce Category Sort Dropdown
- Woocommerce: all products of all categories instead products of one category
- How to get WooCommerce Product Categories and its children’s children?
- Woocommerce change tag_id to name
- set a parent category in a product woocommerce
- No results found for second level category
- How to Manage and link certain custom taxonomy?
- $args Orderby The number
- Category menu that filters out empty categories
- ACF plugin categories bug in WordPress 3.9
- woocommerce – products by category slug? [closed]
- How can I add a Categories page link to a menu? [closed]
- Formating content in category.php
- How to structure Multisite sites into categories?
- Converting Categories (with ACF fields) to custom taxonomies
- WooCommerce category display in custom page
- Sorting Woocommerce products by category and attributes
- Woocommerce custom taxonomy order
- Update wordpress menu with woocommerce products
- How to get Woocomerce categories count
- Get all categories
- Woocommerce Force the category choice before creating new product? [duplicate]
- How Do I Add HTML Support to the Additional Category Description Field?
- Function to reference post meta in place of category Woocommerce
- Restricted category in Woocommerce [closed]