| @@ -90,25 +90,11 @@ | ||
| 90 | 90 | * @return void |
| 91 | 91 | */ |
| 92 | 92 | public static function deactivation() { |
| 93 | 93 | delete_option( 'shopbuilder_permalinks_flushed' ); |
| 94 | - self::clear_scheduled_events(); | |
| 95 | 94 | } |
| 95 | + | |
| 96 | 96 | /** |
| 97 | - * Clear Scheduled Events | |
| 98 | - * | |
| 99 | - * @return void | |
| 100 | - */ | |
| 101 | - public static function clear_scheduled_events() { | |
| 102 | - $schedule = get_option( 'rtsb_cron_schedule_free', [] ); | |
| 103 | - if ( empty( $schedule ) ) { | |
| 104 | - return; | |
| 105 | - } | |
| 106 | - foreach ( $schedule as $v ) { | |
| 107 | - wp_clear_scheduled_hook( $v ); | |
| 108 | - } | |
| 109 | - } | |
| 110 | - /** | |
| 111 | 97 | * Set default options. |
| 112 | 98 | * |
| 113 | 99 | * @return void |
| 114 | 100 | */ |
| @@ -128,8 +114,9 @@ | ||
| 128 | 114 | $type = 'array' === gettype( $field['value'] ) ? [] : ''; |
| 129 | 115 | $rawOptions[ $field_id ] = ! empty( $field['value'] ) ? $field['value'] : $type; |
| 130 | 116 | } |
| 131 | 117 | } |
| 118 | + | |
| 132 | 119 | Fns::set_options( $sections_id, $blocks_id, $rawOptions ); |
| 133 | 120 | } |
| 134 | 121 | } |
| 135 | 122 | } |
| @@ -140,8 +127,9 @@ | ||
| 140 | 127 | * |
| 141 | 128 | * @return int |
| 142 | 129 | */ |
| 143 | 130 | public static function create_wc_product() { |
| 131 | + | |
| 144 | 132 | $product = new WC_Product_Simple(); |
| 145 | 133 | $product->set_name( 'Confirm at least one product is created before deleting' ); |
| 146 | 134 | $product->set_description( 'This is a ShopBuilder demo preview product' ); |
| 147 | 135 | $product->set_short_description( 'This is a ShopBuilder product' ); |
| @@ -150,8 +138,12 @@ | ||
| 150 | 138 | $product->set_regular_price( 50 ); |
| 151 | 139 | $product->set_sale_price( 49 ); |
| 152 | 140 | $product->set_price( 49 ); |
| 153 | 141 | |
| 154 | - $product->set_sku( '' ); | |
| 142 | + $product->set_sku( 'SAMPLE-001' ); | |
| 143 | + | |
| 144 | + $product->set_manage_stock( false ); | |
| 145 | + $product->set_stock_status( 'instock' ); | |
| 146 | + | |
| 155 | 147 | return $product->save(); |
| 156 | 148 | } |
| 157 | 149 | } |