Pro vývojáře
Shortcode
Section titled “Shortcode”[wpify_woo_delivery_dates]
Section titled “[wpify_woo_delivery_dates]”Zobrazí blok s termíny doručení na libovolném místě.
[wpify_woo_delivery_dates]Filtry
Section titled “Filtry”wpify_woo_delivery_dates_days
Section titled “wpify_woo_delivery_dates_days”Upravuje počet dní pro výpočet termínu.
add_filter( 'wpify_woo_delivery_dates_days', function( $days, $product, $days_group ) { // Přidat extra den pro těžké produkty if ( $product->get_weight() > 30 ) { return is_numeric( $days ) ? $days + 1 : $days; } return $days;}, 10, 3 );| Parametr | Typ | Popis |
|---|---|---|
$days | string/int | Počet dní nebo text |
$product | WC_Product | Aktuální produkt |
$days_group | array | Nastavení skupiny termínů |
wpify_woo_delivery_dates_data
Section titled “wpify_woo_delivery_dates_data”Upravuje data zobrazená v bloku termínů.
add_filter( 'wpify_woo_delivery_dates_data', function( $data ) { // Změnit formát data $data['message'] = 'Expedujeme ' . $data['date']; return $data;} );| Parametr | Typ | Popis |
|---|---|---|
$data | array | date, message, more_info_label, more_info_text, shipping_methods |
wpify_woo_delivery_dates_shipping_table_line
Section titled “wpify_woo_delivery_dates_shipping_table_line”Upravuje řádek v tabulce doručovacích metod.
add_filter( 'wpify_woo_delivery_dates_shipping_table_line', function( $line_data, $method ) { // Přidat ikonu $line_data['title'] = '📦 ' . $line_data['title']; return $line_data;}, 10, 2 );| Parametr | Typ | Popis |
|---|---|---|
$line_data | array | title, price |
$method | WC_Shipping_Method | Objekt doručovací metody |
wpify_woo_delivery_dates_payment_table_line
Section titled “wpify_woo_delivery_dates_payment_table_line”Upravuje řádek v tabulce platebních metod.
add_filter( 'wpify_woo_delivery_dates_payment_table_line', function( $line_data, $gateway ) { // Přidat poplatek if ( $gateway->id === 'cod' ) { $line_data['price'] = wc_price( 50 ); } return $line_data;}, 10, 2 );| Parametr | Typ | Popis |
|---|---|---|
$line_data | array | title, price |
$gateway | WC_Payment_Gateway | Objekt platební metody |
wpify_woo_delivery_dates_payments_data
Section titled “wpify_woo_delivery_dates_payments_data”Upravuje data o platebních metodách.
add_filter( 'wpify_woo_delivery_dates_payments_data', function( $data ) { $data['message'] = 'Platba při převzetí nebo kartou'; return $data;} );| Parametr | Typ | Popis |
|---|---|---|
$data | array | message, more_info_label, more_info_text |
wpify_woo_delivery_dates_disable_country_select
Section titled “wpify_woo_delivery_dates_disable_country_select”Vypíná selector země.
add_filter( 'wpify_woo_delivery_dates_disable_country_select', '__return_true' );Vrací: bool - true pro vypnutí selectoru
Meta data produktu
Section titled “Meta data produktu”_wpify_woo_delivery_dates
Section titled “_wpify_woo_delivery_dates”Ukládá přepsané hodnoty termínů pro konkrétní produkt.
$delivery_data = get_post_meta( $product_id, '_wpify_woo_delivery_dates', true );
// Struktura:// [// 'delivery_dates_UUID' => [// 'delivery_days_in_stock' => '1',// 'delivery_days_out_of_stock' => '7',// 'delivery_days_backorder' => '14',// ],// ]CSS třídy
Section titled “CSS třídy”| Třída | Popis |
|---|---|
.wpify-woo-delivery-date | Hlavní kontejner |
.wpify-woo-delivery-date__title | Titulek bloku |
.wpify-woo-delivery-date__line | Řádek s termínem |
.wpify-woo-delivery-date__info | Rozšířené informace |
.wpify-woo-delivery-date__country-select | Selector země |
.wpify-woo-delivery-date__shipping-methods | Tabulka doručení |
.wpify-woo-delivery-date__payments | Tabulka plateb |
REST API
Section titled “REST API”Modul registruje REST API endpoint pro AJAX aktualizace při změně země.