Single product – Exclude attributes van tab

function mycode_hide_attributes_from_additional_info_tabs( $attributes, $product ) { /** * Array of attributes to hide from the Additional Information * tab on single WooCommerce product pages. */ $hidden_attributes = [ ‘pa_kleur’, ‘pa_maat’, ‘pa_lengtemaat’, ‘pa_filter-color’, ‘pa_taillemaat’, ‘pa_merk’ ]; foreach ( $hidden_attributes as $hidden_attribute…Continue reading

Product category – Reviews

add_filter( ‘woocommerce_product_get_rating_html’, function( $html, $rating, $count ) { if ( is_product() || ! $html ) { return $html; // alleen aanpassen op archiefpagina’s met sterren } global $product; if ( ! $product instanceof WC_Product ) { return $html; } $review_count…Continue reading

Global – Winkelmededeling

add_action( ‘wp_body_open’, ‘toon_winkelmededeling_banner’ ); function toon_winkelmededeling_banner() { $tekst = get_field( ‘winkelmededeling_tekst’, ‘option’ ); $link = get_field( ‘winkelmededeling_link’, ‘option’ ); $start_datum = get_field( ‘winkelmededeling_start’, ‘option’ ); $start_tijd = get_field( ‘winkelmededeling_starttijd’, ‘option’ ); $eind_datum = get_field( ‘winkelmededeling_einde’, ‘option’ ); $eind_tijd = get_field(…Continue reading

Single product – Variable price

// functions.php (child theme) of via Code Snippets add_action( ‘wp_head’, function () { if ( is_product() ) { echo ‘ ‘; } }); // 1) Toon ALTIJD de variatieprijs, ook als die gelijk is aan de parent-prijs add_filter( ‘woocommerce_show_variation_price’, ‘__return_true’…Continue reading

Gravity Forms – product list

// ============================================================================ // Gravity Forms: vul keuzelijst met producten en selecteer huidig product // Filters: gform_pre_render/admin_pre_render/pre_validation/pre_submission_filter // ============================================================================ add_filter( ‘gform_pre_render’, ‘populate_product_select_with_selected’ ); add_filter( ‘gform_admin_pre_render’, ‘populate_product_select_with_selected’ ); add_filter( ‘gform_pre_validation’, ‘populate_product_select_with_selected’ ); add_filter( ‘gform_pre_submission_filter’, ‘populate_product_select_with_selected’ ); function populate_product_select_with_selected( $form ) { if(…Continue reading

Single product – Sort attributes kleur first

add_filter( ‘woocommerce_product_get_attributes’, function( $attributes, $product ) { // Mogelijke kleur-attribuutnamen $color_keys = [ ‘pa_kleur’, ‘pa_color’ ]; // Zoek welke aanwezig is $found_key = null; foreach ( $color_keys as $key ) { if ( isset( $attributes[ $key ] ) ) {…Continue reading

Backend – Sort columns

add_filter( ‘manage_edit-product_columns’, ‘descriptions_product_column’, 10); add_filter( ‘manage_edit-product_sortable_columns’, ‘descriptions_product_sortable_column’, 10); add_action( ‘manage_product_posts_custom_column’, ‘descriptions_product_column_content’, 10, 2 ); function descriptions_product_column($columns){ $new_columns = []; foreach( $columns as $key => $column ){ $new_columns[$key] = $columns[$key]; if( $key == ‘price’ ) { $new_columns[‘short_description’] = ‘Korte omschrijving’; $new_columns[‘content’]…Continue reading

Single product | backend – Add metaboxes

/** * Custom metaboxes voor WooCommerce producten */ add_action(‘add_meta_boxes’, function () { add_meta_box( ‘custom_metabox_highlighted_product’, ‘Uitgelicht product’, ‘highlighted_product_custom_metabox’, ‘product’, ‘normal’, ‘high’ ); add_meta_box( ‘custom_metabox_remarks’, ‘Beoordeling’, ‘product_remarks_custom_metabox’, ‘product’, ‘normal’, ‘high’ ); add_meta_box( ‘custom_metabox_video’, ‘Product video’, ‘product_video_custom_metabox’, ‘product’, ‘normal’, ‘high’ ); }); function…Continue reading

Single product – Move price – Producttitle – Rating

// Move single product title remove_action(‘woocommerce_single_product_summary’, ‘woocommerce_template_single_title’, 5); add_action(‘woocommerce_before_single_product_summary’, ‘woocommerce_template_single_title’, 10); // Verplaats alleen de rating (sterren + “(x klantbeoordelingen)”) remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_rating’, 10 ); add_action( ‘woocommerce_before_single_product_summary’, ‘woocommerce_template_single_rating’, 12 ); // Verplaats productprijs voor álle producttypes add_action(‘woocommerce_single_product_summary’, ‘custom_move_product_price’, 1); function…Continue reading