Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bekarice/33c3858b0c2e744fd2f503b840820284 to your computer and use it in GitHub Desktop.
Save bekarice/33c3858b0c2e744fd2f503b840820284 to your computer and use it in GitHub Desktop.
2 Examples on how to change variation SKU separators w/ Product SKU Generator
<?php // only copy this line if needed
/**
* Example 1: Changes the separator between variations in a generated SKU
*
* @param string $separator the original separator
* @return string the new separator
*/
function sv_wc_replace_variation_sku_separator( $separator ) {
return '_';
}
add_filter( 'wc_sku_generator_attribute_separator', 'sv_wc_replace_variation_sku_separator' );
// OR
// Example 2: Removes the separator between variations in a generated SKU
add_filter( 'wc_sku_generator_attribute_separator', '__return_empty_string' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment