Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter rosalynteltronix

    (@rosalynteltronix)

    Hi Steve,

    I have managed to get around my issue by adding snippet to work in conjunction with your plugin, it allows duplicate SKUs. As your plugin doesn’t allow for a blank main product SKU in order to generate variations.

    This way, I use ‘:’ in all parent product SKUs. Your plugin then recognises it as a SKU, and generates exactly as I hoped. so my SKUs look like this until I select from the dropdown…

    Example PN :

    Then this…

    Example PN :FBRA1FRPBLK4PVSM

    In an ideal world, I would have liked to have left the SKU blank (without the ‘:’) but as I said, your plugin won’t allow for this.

    I also used some snippets suggested in another thread to remove dashes.

    // Removes the separator between variations in a generated SKU
    add_filter( ‘wc_sku_generator_attribute_separator’, ‘__return_empty_string’ );

    $product_sku = apply_filters( ‘wc_sku_generator_sku’, $product_sku, $product );

    if ( !empty( $product_sku ) ) {

    }
    // Removes the unique SKU function allowing for duplicate SKUs

    add_filter( ‘wc_product_has_unique_sku’, ‘__return_false’ );

    /**
    * Adjust the format of generated SKUs
    *
    * @param string $sku the original complete SKU
    * @param string $product_sku the parent product SKU
    * @param string $variation_sku the SKU to represent a variation, if set
    * @return string the updated complete SKU
    */
    function sv_wc_alter_generated_sku( $sku, $product_sku, $variation_sku ) {
    return $product_sku . $variation_sku;
    }
    add_filter( ‘wc_sku_generator_variation_sku_format’, ‘sv_wc_alter_generated_sku’, 10, 3 );`

    Thread Starter rosalynteltronix

    (@rosalynteltronix)

    Thank you so much for taking the time to look. I should have marked this as resolved. I found it wasn’t liking having two categories selected at the same time. when just selecting one, it all worked as required. Still very strange that it worked when the word special wasn’t included. Hey-ho!
    Thanks again.

Viewing 2 replies - 1 through 2 (of 2 total)