Přeskočit na obsah

Pro vývojáře

Zobrazí blok s termíny doručení na libovolném místě.

[wpify_woo_delivery_dates]

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 );
ParametrTypPopis
$daysstring/intPočet dní nebo text
$productWC_ProductAktuální produkt
$days_grouparrayNastavení skupiny termínů

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;
} );
ParametrTypPopis
$dataarraydate, 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 );
ParametrTypPopis
$line_dataarraytitle, price
$methodWC_Shipping_MethodObjekt 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 );
ParametrTypPopis
$line_dataarraytitle, price
$gatewayWC_Payment_GatewayObjekt platební metody

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;
} );
ParametrTypPopis
$dataarraymessage, 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

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',
// ],
// ]
TřídaPopis
.wpify-woo-delivery-dateHlavní kontejner
.wpify-woo-delivery-date__titleTitulek bloku
.wpify-woo-delivery-date__lineŘádek s termínem
.wpify-woo-delivery-date__infoRozšířené informace
.wpify-woo-delivery-date__country-selectSelector země
.wpify-woo-delivery-date__shipping-methodsTabulka doručení
.wpify-woo-delivery-date__paymentsTabulka plateb

Modul registruje REST API endpoint pro AJAX aktualizace při změně země.