• Resolved dx

    (@designxuk)


    Hi I create a variable product using following code. It shows this new product type on the product type drop down menu but after select this and save the product, product type saving as a “Variable product”, not “Variable new product”.

    How I can correct this one?

    Thanks for help.

    function register_variable_new_product_type() {
    	class  WC_Product_New_Variable extends WC_Product_Variable {
        	public $product_type = 'new_variable';
        	public function __construct( $product ) {
            	parent::__construct( $product );
    		}
    	}
    }
    add_action( 'init', 'register_variable_new_product_type' );
    
    function add_variable_new_product( $types ){
        $types[ 'new_variable' ] = __( 'Variable new product' );
        return $types;
    }
    add_filter( 'product_type_selector', 'add_variable_new_product' );
    • This topic was modified 4 years, 1 month ago by dx.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    Hi there ??

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Cheers!

    Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    We’ve not seen any activity on this thread for a while, so I’m marking this thread as resolved.

    Hopefully, you were able to find a solution to your problem! If you have further questions, please feel free to open a new topic.

    Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom variable product type doesn’t work’ is closed to new replies.