fix stock status is not correct in JSON structure data if product is onbackorder
This commit is contained in:
parent
950bf937d7
commit
4f59b717d4
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
fix stock status is not correct in JSON structure data if product is onbackorder
|
|
@ -257,9 +257,25 @@ class WC_Structured_Data {
|
|||
);
|
||||
}
|
||||
|
||||
$stock_status = $product->get_stock_status();
|
||||
|
||||
switch ( $stock_status ) {
|
||||
case "instock":
|
||||
$stock_status_schema = "InStock";
|
||||
break;
|
||||
case "outofstock":
|
||||
$stock_status_schema = "OutOfStock";
|
||||
break;
|
||||
case "onbackorder":
|
||||
$stock_status_schema = "BackOrder";
|
||||
break;
|
||||
default:
|
||||
$stock_status_schema = "";
|
||||
}
|
||||
|
||||
$markup_offer += array(
|
||||
'priceCurrency' => $currency,
|
||||
'availability' => 'http://schema.org/' . ( $product->is_in_stock() ? 'InStock' : 'OutOfStock' ),
|
||||
'availability' => 'http://schema.org/' . $stock_status_schema,
|
||||
'url' => $permalink,
|
||||
'seller' => array(
|
||||
'@type' => 'Organization',
|
||||
|
|
Loading…
Reference in New Issue