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

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

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

Global – Change sale to % sale

// Bereken kortingspercentages function my_get_discount_percentages( $product ) { $percentages = []; if ( $product->is_type( ‘variable’ ) ) { $prices = $product->get_variation_prices( true ); foreach ( $prices[‘regular_price’] as $key_id => $regular_price ) { $sale_price = $prices[‘price’][ $key_id ]; if ( $regular_price…Continue reading

Checkout – Spaarbedrag shortcode + afhaalpunt fix

// Toon totaal spaarbedrag op basis van winkelmand in (FunnelKit) checkout function shortcode_spaar_bedrag_checkout() { // Controleer of WooCommerce actief is if ( ! function_exists( ‘WC’ ) || ! WC()->cart ) { return ”; } // FunnelKit laadt niet altijd als…Continue reading

Product category – Shortcode for category image

/** * Shortcode: toon de thumbnail van de huidige WooCommerce productcategorie * * Gebruik: [category_thumbnail] */ function woocommerce_category_image_shortcode() { // Alleen uitvoeren op categorie-archieven if ( ! is_product_category() ) { return ”; // niets tonen buiten categoriepagina } global $wp_query;…Continue reading

Add headers to API request adding user to Brevo email list

add_filter( ‘frm_api_request_args’, ‘my_custom_frm_api_request_header’, 10, 2 ); function my_custom_frm_api_request_header( $arg_array, $args ) { if ( $args[‘url’] == ‘https://api.brevo.com/v3/contacts/’ ) { // the full url where the request is being sent $arg_array[‘headers’][‘api-key’] = ‘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’; //Replace Your-API-Key-Here with your Brevo API key }…Continue reading