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
- Display All Products by Category with WooCommerce
- Retrieve Product category ‘NAME’ by product category ID – WooCommerce?
- Woocommerce get category image full size
- Order get_terms() By Custom Field
- get_field not displaying my custom field value
- Programmatically create product category and add thumbnail in woocommerce
- Add extra fields to Add New Category page
- Reflect nested categories in appearance > menus
- Create product category and keyword search form in woocommerce? [closed]
- echo get_post_meta of all post in a category to fill up a select field
- Do not show sub categories in the loop on archive-product.php
- List just subcategory and products of active category page in Woocommerce
- List a maximum of ‘x’ product categories with qty of ‘y’ in each column
- Display all product tags associated with a specific product category
- why get_the_post_thumbnail( the_ID()) echos extra post id
- How to access deleted term inside delete_product_cat action
- Apply WordPress function on specific woocommerce product categories only
- Filter WooCommerce archive pages by an additional category
- Grandchild Term Things Grandfather Term is It’s Parent
- “Virtual category page” based on a custom field filter
- Custom tax_query filter not working for Woocommerce product categories
- How do order product categories – on a parent category page – in Woocommerce?
- Woocommerce filter function not updating
- Adding custom ID field to the categories
- How can i change what one category displays?
- Remove any product that is featured from regular display loop [WooCommerce]
- Two Sections on Woocommerce Catergory Page [closed]
- Woocommerce search form with category select
- How to display product with two condition, category and brand taxonomy
- Show different menu on each woocommerce category page
- ACF no print data [closed]
- Template for product-category page [closed]
- Displaying a custom field in Category Archives
- Assign a custom post to a custom taxonomy based on custom field value
- 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
- Show posts from category specified using a custom field
- Adding tinymce to Custom Field boxes on Category edit page
- WooCommerce shared categories
- 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)
- How can i add service category here? [duplicate]
- category description not showing in my woocommerce
- Conditional label Woocommerce archive [unsolved]
- Sort categories by custom field in WordPress admin
- Show audio player only in specific post type category
- How to make product image inherit from category image
- How to show given products only using product id array from specific category page in woocommerce
- Shop Category Pages missing s
- How to set acf color field as background color to product category
- How to target all woocommerce categories that don’t have any subcategories in them?
- WooCommerce REST API not returning the default products category
- 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?
- Show the parent taxonomy by creating shortcode in woocommerce?
- How can I display all products from all categories on one page with woocommerce?
- How to add all subcategories as submenu in WordPress menu
- How to edit woocommerce sub-category page
- When creating a new product, auto assign it to all custom taxonomy woocommerce
- Modifying category order
- Displaying data from custom fields on a specific category page
- Get WooCommerce product category list in functions.php
- in post content shortcode works, but hardcoded in same page template doesn’t?
- 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 fix 404 error in pagination in categories of woocommerce with common url base /shop/?
- How do I merge WooCommerce categories with the same name?
- 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 delete WooCommerce categories in bulk that only have one product
- Product Category page showing all products
- How to load terms of a custom taxonomy of a product in woocommerce cart page
- product_cat image url from database
- How to get WooCommerce Product Categories and its children’s children?
- Woocommerce change tag_id to name
- Woocommerce product catalog, products with different description
- Ajax Category add doesn’t update the list table custom column
- WooCommerce – Get products from category right before deleting category
- set a parent category in a product woocommerce
- No results found for second level category
- How to display products with multiple conditions, product_id and category_id
- Categories and Tags Conflict after Woocommerce Installation
- How to Manage and link certain custom taxonomy?
- Custom field picture instead of post thumbnail on category page
- How to get related category/categories in WordPress archive page
- How to loop through a custom field for each post, & display?
- $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