Skip to content

Commit

Permalink
By default, do not treat downloadable as virtual product option when …
Browse files Browse the repository at this point in the history
…dealing with shipping costs/delivery times. Set supporting locations for checkout-specific checkboxes.
  • Loading branch information
dennisnissle committed Jan 3, 2025
1 parent ddae228 commit 417996c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -530,9 +530,8 @@ protected function get_digital_type_options() {
$product_types = wc_get_product_types();
$digital_type_options = array_merge(
array(
'downloadable' => __( 'Downloadable Product', 'woocommerce-germanized' ),
'virtual' => __( 'Virtual Product', 'woocommerce-germanized' ),
'service' => __( 'Service', 'woocommerce-germanized' ),
'virtual' => __( 'Virtual Product', 'woocommerce-germanized' ),
'service' => __( 'Service', 'woocommerce-germanized' ),
),
$product_types
);
Expand Down
20 changes: 13 additions & 7 deletions includes/class-wc-gzd-legal-checkbox-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,9 @@ public function register_core_checkboxes() {
'is_shown' => false,
'admin_name' => __( 'Digital', 'woocommerce-germanized' ),
'admin_desc' => __( 'Asks the customer to skip revocation period for digital products.', 'woocommerce-germanized' ),
'locations' => array( 'checkout' ),
'locations' => array( 'checkout', 'pay_for_order' ),
'types' => array( 'downloadable' ),
'supporting_locations' => array( 'checkout', 'pay_for_order' ),
)
);

Expand All @@ -193,7 +194,8 @@ public function register_core_checkboxes() {
'is_shown' => false,
'admin_name' => __( 'Service', 'woocommerce-germanized' ),
'admin_desc' => __( 'Asks the customer to skip revocation period for services.', 'woocommerce-germanized' ),
'locations' => array( 'checkout' ),
'locations' => array( 'checkout', 'pay_for_order' ),
'supporting_locations' => array( 'checkout', 'pay_for_order' ),
)
);

Expand All @@ -211,10 +213,10 @@ public function register_core_checkboxes() {
'error_message' => __( 'Please accept our parcel delivery agreement', 'woocommerce-germanized' ),
'is_core' => true,
'is_shown' => false,
'supporting_locations' => array( 'checkout' ),
'admin_name' => __( 'Parcel Delivery', 'woocommerce-germanized' ),
'admin_desc' => __( 'Asks the customer to hand over data to the parcel delivery service provider.', 'woocommerce-germanized' ),
'locations' => array( 'checkout' ),
'locations' => array( 'checkout', 'pay_for_order' ),
'supporting_locations' => array( 'checkout', 'pay_for_order' ),
)
);

Expand All @@ -235,7 +237,7 @@ public function register_core_checkboxes() {
'is_shown' => false,
'admin_name' => __( 'Age Verification', 'woocommerce-germanized' ),
'admin_desc' => __( 'Asks the customer to confirm a minimum age.', 'woocommerce-germanized' ),
'locations' => array( 'checkout' ),
'locations' => array( 'checkout', 'pay_for_order' ),
)
);

Expand Down Expand Up @@ -304,6 +306,7 @@ public function register_core_checkboxes() {
'admin_name' => __( 'SEPA', 'woocommerce-germanized' ),
'admin_desc' => __( 'Asks the customer to issue the SEPA mandate.', 'woocommerce-germanized' ),
'locations' => array( 'checkout', 'pay_for_order' ),
'supporting_locations' => array( 'checkout', 'pay_for_order' ),
)
);
}
Expand All @@ -323,7 +326,8 @@ public function register_core_checkboxes() {
'is_shown' => false,
'admin_name' => __( 'Used Goods', 'woocommerce-germanized' ),
'admin_desc' => __( 'Inform customers about shortened warranty for used goods.', 'woocommerce-germanized' ),
'locations' => array( 'checkout' ),
'locations' => array( 'checkout', 'pay_for_order' ),
'supporting_locations' => array( 'checkout', 'pay_for_order' ),
)
);

Expand All @@ -343,7 +347,8 @@ public function register_core_checkboxes() {
'is_shown' => false,
'admin_name' => __( 'Defective Copies', 'woocommerce-germanized' ),
'admin_desc' => __( 'Inform customers about product defects.', 'woocommerce-germanized' ),
'locations' => array( 'checkout' ),
'locations' => array( 'checkout', 'pay_for_order' ),
'supporting_locations' => array( 'checkout', 'pay_for_order' ),
)
);

Expand All @@ -365,6 +370,7 @@ public function register_core_checkboxes() {
'admin_name' => __( 'Photovoltaic Systems', 'woocommerce-germanized' ),
'admin_desc' => __( 'Let customers confirm that they are aware of the requirements for a VAT exemption.', 'woocommerce-germanized' ),
'locations' => array( 'checkout', 'pay_for_order' ),
'supporting_locations' => array( 'checkout', 'pay_for_order' ),
)
);
}
Expand Down
2 changes: 1 addition & 1 deletion includes/class-wc-gzd-legal-checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ public function set_locations( $locations ) {
* @return array
*/
public function get_supporting_locations() {
return $this->settings['supporting_locations'];
return apply_filters( 'woocommerce_gzd_legal_checkbox_get_supporting_locations', $this->settings['supporting_locations'], $this );
}

public function set_supporting_locations( $locations ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function shopmarks( $post_id ) {
foreach ( wc_gzd_get_single_product_shopmarks() as $shopmark ) {
$callback = $shopmark->get_callback();

if ( function_exists( $callback ) && $shopmark->is_enabled() && apply_filters( "woocommerce_gzd_product_addons_embed_price_label", true, $shopmark->get_type(), $shopmark, $product ) ) {
if ( function_exists( $callback ) && $shopmark->is_enabled() && apply_filters( 'woocommerce_gzd_product_addons_embed_price_label', true, $shopmark->get_type(), $shopmark, $product ) ) {
call_user_func( $callback );
}
}
Expand Down

0 comments on commit 417996c

Please sign in to comment.