500x450x120 mm

Enig resultaat

// Voeg de voorraadstatus toe aan de productpagina via de WooCommerce-hook add_action( 'woocommerce_single_product_summary', 'toon_custom_voorraad_status', 20 ); function toon_custom_voorraad_status() { global $product; // Verkrijg de waarde uit het custom veld (meta key: product_stock_status) $voorraad = get_post_meta( $product->get_id(), 'product_stock_status', true ); // Bepaal de tekst en CSS-class op basis van de waarde switch ( $voorraad ) { case '1': $tekst = 'Op voorraad'; $class = 'voorraad-op'; break; case '2': $tekst = 'Beperkte voorraad'; $class = 'voorraad-beperkt'; break; case '9': $tekst = 'Op aanvraag'; $class = 'voorraad-aanvraag'; break; default: $tekst = 'Geen voorraad informatie'; $class = 'voorraad-onbekend'; break; } // Maak een array met de data die je wilt doorgeven aan de template $voorraad_status = array( 'tekst' => $tekst, 'class' => $class, ); // Laad de template; dit voorbeeld gebruikt wc_get_template (standaard in WooCommerce) wc_get_template( 'voorraad-status.php', $voorraad_status ); }