jameskoster / woocommerce-product-details-customiser

15 stars 5 forks source link

Enhancement Idea: display/hide SKU #5

Open MadSpaniard opened 10 years ago

MadSpaniard commented 10 years ago

Hello - I thought it might be helpful to add SKU as one of the items that can be hidden using this plugin. I tried inserting the following code snippets to "details-customiser.php" and these seem to work:

Inserted this on line #52:

array(
    'desc'      => __( 'Product SKU', 'woocommerce-product-details-customiser' ),
    'id'        => 'wc_pdc_sku',
    'type'      => 'checkbox',
    'default'   => 'yes'
),

Inserted this on line #98:

add_option( 'wc_pdc_sku', 'yes' );

Inserted this on line #172:

// SKU
if ( get_option( 'wc_pdc_sku' ) == 'no' ) {
    add_filter( 'wc_product_sku_enabled', '__return_false' );
}

Do you think something of this ilk may be worth including in your plugin?

Thanks as always.

jameskoster commented 10 years ago

Doesn't the wc_product_sku_enabled filter disable the SKU globally, not just the display?

MadSpaniard commented 10 years ago

You are correct... well, the suggestion for "hide sku" may have had a worthy intent, but not so worthy implementation... Of course, a CSS tweak or an adjustment to the underlying template file could achieve the desired result, but was trying to come up with a more dynamic solution that could be easily toggled... maybe the CSS tweak is the next best thing for now.

Thanks for looking into this, best regards.

jameskoster commented 10 years ago

Yeah I don't really have time to add this myself right now. Do feel free to send a PR if you want to investigate further though :-)