Skip to content

Commit

Permalink
Force showing editable checkboxes for manually created orders.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisnissle committed Jan 15, 2024
1 parent b631208 commit 9d309e5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions includes/class-wc-gzd-legal-checkbox-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1254,14 +1254,17 @@ public function get_editable_checkboxes( $location ) {
*/
public function render_checkbox_log( $object, $location = 'order' ) {
$checkboxes = $this->get_loggable_checkboxes( $location );
$editable = $this->get_editable_checkboxes( $location );
$checkboxes_to_list = array();

foreach ( $checkboxes as $checkbox_id ) {
if ( $checkbox = wc_gzd_get_legal_checkbox( $checkbox_id ) ) {
$is_checked = $this->is_checked( $checkbox_id, $object );
$is_logged = $this->is_logged( $checkbox_id, $object );
$is_checked = $this->is_checked( $checkbox_id, $object );
$is_logged = $this->is_logged( $checkbox_id, $object );
$is_editable = in_array( $checkbox_id, $editable, true );
$is_manual = is_a( $object, 'WC_Order' ) ? 'admin' === $object->get_created_via() : false;

if ( $is_logged ) {
if ( $is_logged || ( $is_manual && $is_editable ) ) {
$checkboxes_to_list[ $checkbox_id ] = $is_checked;
}
}
Expand All @@ -1278,7 +1281,7 @@ public function render_checkbox_log( $object, $location = 'order' ) {
<div class="wc-gzd-log-checkbox">
<p class="checkbox-title"><?php echo esc_html( $checkbox->get_admin_name() ); ?> <?php echo ( ! empty( $checkbox->get_admin_desc() ) ? wc_help_tip( $checkbox->get_admin_desc() ) : '' ); ?></p>
<p class="checkbox-status">
<?php if ( in_array( $checkbox_id, $this->get_editable_checkboxes( $location ), true ) ) : ?>
<?php if ( in_array( $checkbox_id, $editable, true ) ) : ?>
<?php
WC_GZD_Admin::instance()->render_toggle(
array(
Expand Down

0 comments on commit 9d309e5

Please sign in to comment.