• Hey team.

    Situation: I’m running a woocommerce store. Most products are variable types, each with 5 variations. 2 of these are typical variables, 3 are subscription product types. I’m trying to use a sitewide sale plugin but it wont let me filter out the “subscription” custom product types. When I try and exclude a specific product it is only returning root level products, not variations.

    Solution A: How do I adjust the following code to return the Variable-level SKU? Do I need to change anything anywhere else?

    array(
    	'title' 			=> __( 'Exclude products', 'wc-simple-storewide-sale' ),
    	'desc' 				=> __( 'Select product to exclude from sale.', 'wc-simple-storewide-sale' ),
    	'type' 				=> 'ajaxproduct',
    	'id'				=> 'wcsss_exclude_product',
    	'default' 			=> '',
    	'desc_tip'			=>  true,					
    				), 

    Solution B: How do I adjust the following code to allow me to exclude Variation-level custom product types (e.g. Subscription)

    		array(
    					'title' 			=> __( 'Exclude Category', 'wc-simple-storewide-sale' ),
    					'desc' 				=> __( 'Select product categories to exclude from sale.', 'wc-simple-storewide-sale' ),
    					'type' 				=> 'multiselect',
    					'id'				=> 'wcsss_exclude_cat',
    					'default' 			=> '',
    					'class'				=> 'chosen_select_nostd',
    					'options' 			=> $product_categories_select,
    					'desc_tip'			=>  true,
    				), 
    		array(
    					'title' 			=> __( 'Exclude Category', 'wc-simple-storewide-sale' ),
    					'desc' 				=> __( 'Select product categories to exclude from sale.', 'wc-simple-storewide-sale' ),
    					'type' 				=> 'multiselect',
    					'id'				=> 'wcsss_exclude_cat',
    					'default' 			=> '',
    					'class'				=> 'chosen_select_nostd',
    					'options' 			=> $product_categories_select,
    					'desc_tip'			=>  true,
    				), 

    Thanks so much!

Viewing 1 replies (of 1 total)
  • Thread Starter tegyn

    (@tegyn)

    sorry, that 2nd line of code should read:

    public function get_settings() {
    
    		$product_categories_select = array();
    		$product_tag_select = array();
    
    		$product_categories = get_terms ('product_cat') ;
    		$product_tag = get_terms ('product_tag') ;
    
    		foreach ($product_categories as $key => $value) {
    
    			$product_categories_select [$value->term_id] = $value->name;
    		}
    
Viewing 1 replies (of 1 total)
  • The topic ‘[WooCommerce] Get SKU -OR- Custom product type’ is closed to new replies.