Viewing 5 replies - 1 through 5 (of 5 total)
  • You can create a “template product” with the settings you want and then duplicate it when creating a new product.

    If you use the REST API, you can set the backorder status programatically.

    Plugin Contributor Claudio Sanches

    (@claudiosanches)

    You can achieve it using this filter in your theme’s functions.php or writing a plugin:

    add_filter( 'woocommerce_product_backorders_allowed', '__return_true' );
    
    Thread Starter bttmrc

    (@bttmrc)

    Thanks lawkwok

    Hey Cláudio thanks I tried it but it’s not working, maybe I should also add to the funtions.php a filter to “Enable stock management at product level” by default?

    Thread Starter bttmrc

    (@bttmrc)

    I was able to achieve the “Enable stock management at product level” by changing the line 294 in the file /woocommerce/includes/admin/meta-boxes/class-wc-meta-box-product-data.php

    to this
    woocommerce_wp_checkbox( array( 'id' => '_manage_stock', 'wrapper_class' => 'show_if_simple show_if_variable', 'label' => __( 'Manage stock?', 'woocommerce' ), 'description' => __( 'Enable stock management at product level', 'woocommerce' ), 'value' => 'yes' ), 'checkbox' );

    But the the “Allow Back Orders” is set to “Don’t allow”

    Thread Starter bttmrc

    (@bttmrc)

    All right,

    I just went to that same file, line 316 and just switched the options positions, from:

    'no'     => __( 'Do not allow', 'woocommerce' ),
    'notify' => __( 'Allow, but notify customer', 'woocommerce' ),
    'yes'    => __( 'Allow', 'woocommerce' )

    TO:

    'notify' => __( 'Allow, but notify customer', 'woocommerce' ),
    'no'     => __( 'Do not allow', 'woocommerce' ),
    'yes'    => __( 'Allow', 'woocommerce' )

    And it worked xD

    But still, if you could help me with something to put in the functions file It would be great. Obrigado

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Allow backorder BY DEFAULT’ is closed to new replies.