Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions includes/ProductSync/ProductValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ public function __get( $key ) {
public function validate() {
$this->validate_sync_enabled_globally();
$this->validate_product_status();
$this->validate_product_stock_status();
$this->validate_product_sync_field();
$this->validate_product_price();
$this->validate_product_visibility();
Expand All @@ -151,7 +150,6 @@ public function validate() {
*/
public function validate_but_skip_status_check() {
$this->validate_sync_enabled_globally();
$this->validate_product_stock_status();
$this->validate_product_sync_field();
$this->validate_product_price();
$this->validate_product_visibility();
Expand All @@ -168,7 +166,6 @@ public function validate_but_skip_status_check() {
*/
public function validate_but_skip_sync_field() {
$this->validate_sync_enabled_globally();
$this->validate_product_stock_status();
$this->validate_product_price();
$this->validate_product_visibility();
$this->validate_product_terms();
Expand Down Expand Up @@ -268,17 +265,6 @@ protected function validate_product_status() {
}
}

/**
* Check whether the product should be excluded due to being out of stock.
*
* @throws ProductExcludedException If product should not be synced.
*/
protected function validate_product_stock_status() {
if ( 'yes' === get_option( 'woocommerce_hide_out_of_stock_items' ) && ! $this->product->is_in_stock() ) {
throw new ProductExcludedException( __( 'Product must be in stock.', 'facebook-for-woocommerce' ) );
}
}

/**
* Check whether the product's visibility excludes it from sync.
*
Expand Down
2 changes: 1 addition & 1 deletion includes/Products.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public static function published_product_should_be_synced( \WC_Product $product
* @return bool
*/
public static function product_should_be_deleted( \WC_Product $product ) {
return ( 'yes' === get_option( 'woocommerce_hide_out_of_stock_items' ) && ! $product->is_in_stock() ) || ! facebook_for_woocommerce()->get_product_sync_validator( $product )->passes_product_terms_check();
return ! facebook_for_woocommerce()->get_product_sync_validator( $product )->passes_product_terms_check();
}


Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/WCFacebookCommerceIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -909,13 +909,13 @@ public function test_delete_on_out_of_stock_deletes_simple_product() {

add_post_meta( $product->get_id(), WC_Facebookcommerce_Integration::FB_PRODUCT_ITEM_ID, 'facebook-product-item-id' );

$this->api->expects( $this->once() )
$this->api->expects( $this->never() )
->method( 'delete_product_item' )
->with( 'facebook-product-item-id' );

$result = $this->integration->delete_on_out_of_stock( $product->get_id(), $product );

$this->assertTrue( $result );
$this->assertFalse( $result );
}

/**
Expand Down