Automattic\WooCommerce\Internal\CLI\Migrator\Platforms\Webflow

WebflowMapper::map_statusprivateWC 1.0

Map Webflow product publication flags to WC status.

Method of the class: WebflowMapper{}

No Hooks.

Returns

String.

Usage

// private - for code of main (parent) class only
$result = $this->map_status( $product ): string;
$product(object) (required)
Product object.

WebflowMapper::map_status() code WC 11.0.1

private function map_status( object $product ): string {
	$is_archived = ! empty( $product->isArchived ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase -- Webflow API uses camelCase.
	$is_draft    = ! empty( $product->isDraft );    // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase -- Webflow API uses camelCase.

	if ( $is_archived ) {
		return 'draft';
	}
	if ( $is_draft ) {
		return 'draft';
	}
	return 'publish';
}