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