Skip to content

Commit

Permalink
Fix for checkout block is not rendered on site editor
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinwy committed Jul 19, 2024
1 parent 719add5 commit fbaca46
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 6 additions & 5 deletions includes/class-wc-gateway-komoju-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ public function get_payment_method_script_handles()

public function get_payment_method_data()
{
if (!is_checkout()) {
return;
}

if (is_wc_endpoint_url('order-received')) {
if (!is_checkout() && !$this->is_site_editor()) {
return;
}

Expand All @@ -75,4 +71,9 @@ public function get_payment_method_data()
'inlineFields' => $this->gateway->has_fields,
];
}

private function is_site_editor()
{
return strpos($_SERVER['REQUEST_URI'], 'site-editor.php');
}
}
4 changes: 4 additions & 0 deletions includes/class-wc-gateway-komoju-single-slug.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ public function create_session_for_fields()
],
];

if ($this->get_order_total() == 0) {
return null;
}

return $komoju_api->createSession($session_params);
}

Expand Down

0 comments on commit fbaca46

Please sign in to comment.