PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.2
JetFormBuilder — Dynamic Blocks Form Builder v3.6.2
3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / compatibility / woocommerce / methods / wc-product-modification / trash-action.php
jetformbuilder / compatibility / woocommerce / methods / wc-product-modification Last commit date
base-product-property.php 2 years ago product-backorders-property.php 2 years ago product-catalog-visibility-property.php 2 years ago product-cross-sell-ids-property.php 2 years ago product-date-on-sale-from-property.php 2 years ago product-date-on-sale-to-property.php 2 years ago product-date-property.php 1 year ago product-description-property.php 1 year ago product-featured-property.php 2 years ago product-gallery-property.php 2 years ago product-height-property.php 2 years ago product-id-property.php 1 year ago product-image-property.php 1 year ago product-length-property.php 2 years ago product-low-stock-amount-property.php 1 year ago product-manage-stock-property.php 1 year ago product-name-property.php 1 year ago product-parent-property.php 1 year ago product-regular-price-property.php 2 years ago product-reviews-allowed-property.php 1 year ago product-sale-price-property.php 2 years ago product-short-description-property.php 1 year ago product-sku-property.php 2 years ago product-sold-individually-property.php 1 year ago product-status-property.php 1 year ago product-stock-quantity-property.php 1 year ago product-stock-status-property.php 1 year ago product-tax-class-property.php 1 year ago product-tax-status-property.php 1 year ago product-total-sales-property.php 1 year ago product-upsell-ids-property.php 2 years ago product-weight-property.php 2 years ago product-width-property.php 2 years ago save-action.php 1 year ago trash-action.php 1 year ago wc-product-modifier.php 1 year ago
trash-action.php
47 lines
1 <?php
2
3
4 namespace JFB_Compatibility\Woocommerce\Methods\Wc_Product_Modification;
5
6 use Jet_Form_Builder\Actions\Methods\Abstract_Modifier;
7 use Jet_Form_Builder\Exceptions\Action_Exception;
8 use JFB_Modules\Actions_V2\Insert_Post\Properties\Trash_Action as Post_Trash_Action;
9
10 // If this file is called directly, abort.
11 if ( ! defined( 'WPINC' ) ) {
12 die;
13 }
14
15 class Trash_Action extends Post_Trash_Action {
16
17 public function get_id(): string {
18 return 'trash';
19 }
20
21 /**
22 * @throws Action_Exception
23 */
24 public function do_action() {
25 if ( ! $this->pre_check() ) {
26 return;
27 }
28 /** @var Product_Id_Property $id */
29 $id = $this->modifier->get( 'ID' );
30
31 if ( ! $id->get_product()->delete() ) {
32 throw new Action_Exception( 'failed' );
33 }
34 }
35
36 public function do_after() {
37 }
38
39 public static function is_supported( Abstract_Modifier $modifier ): bool {
40 /** @var Product_Id_Property $id */
41 $id = $modifier->get( 'ID' );
42 $product = $id->get_product();
43
44 return 'trash' === $product->get_status() && 0 < $product->get_id();
45 }
46 }
47