mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Ensure subscription product description does not exceed 127 characters
This commit is contained in:
parent
d3a02e79c5
commit
a13da931ed
2 changed files with 11 additions and 6 deletions
|
@ -84,12 +84,9 @@ class CatalogProducts {
|
||||||
public function create( string $name, string $description ): Product {
|
public function create( string $name, string $description ): Product {
|
||||||
$data = array(
|
$data = array(
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
|
'description' => $description ?: $name,
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( $description ) {
|
|
||||||
$data['description'] = $description;
|
|
||||||
}
|
|
||||||
|
|
||||||
$bearer = $this->bearer->bearer();
|
$bearer = $this->bearer->bearer();
|
||||||
$url = trailingslashit( $this->host ) . 'v1/catalogs/products';
|
$url = trailingslashit( $this->host ) . 'v1/catalogs/products';
|
||||||
$args = array(
|
$args = array(
|
||||||
|
|
|
@ -178,7 +178,15 @@ class SubscriptionsApiHandler {
|
||||||
$data[] = (object) array(
|
$data[] = (object) array(
|
||||||
'op' => 'replace',
|
'op' => 'replace',
|
||||||
'path' => '/description',
|
'path' => '/description',
|
||||||
'value' => $product->get_description(),
|
'value' => substr(
|
||||||
|
strip_shortcodes(
|
||||||
|
wp_strip_all_tags(
|
||||||
|
$product->get_description()
|
||||||
|
)
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
127
|
||||||
|
) ?: '',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue