Skip to content

Commit 3451283

Browse files
committed
Open product URL with preview parameter
1 parent ec8d76b commit 3451283

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

WooCommerce/Classes/ViewRelated/Products/Edit Product/ProductFormViewController.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,15 @@ private extension ProductFormViewController {
795795
}
796796

797797
func displayProductPreview() {
798+
var permalink = URLComponents(string: product.permalink)
799+
var updatedQueryItems = permalink?.queryItems ?? []
800+
updatedQueryItems.append(.init(name: "preview", value: "true"))
801+
permalink?.queryItems = updatedQueryItems
802+
guard let url = permalink?.url else {
803+
return
804+
}
805+
806+
WebviewHelper.launch(url, with: self)
798807
}
799808

800809
func duplicateProduct() {

0 commit comments

Comments
 (0)